Research Article

Falcon: A Blockchain-Based Edge Service Migration Framework in MEC

Algorithm 1

Constraint protocol checking algorithm.
Input: (1) S, Migration alternative plan (2) R, constraint rule R for agent group operation (including dependency, mutual exclusion, and atomic relations);
Output: Migration_flag, An indication of whether the migration was successful
(1)
(2)ifthen
(3)  return false;
(4)end if
(5)for each in decisionTmp do
(6)  Step 1. Perform a protocol check on alternative migration decisions and define a temporary migration plan WP from each platform of the migration decision . Initialize WP = 
(7)  Step 2. Agent sends a migration request to each destination host in the platform set of migration decision , do
(8)   Step 2.1. Select a platform and add to WP
(9)    
(10)  Step 3.
(11)  for each Constraint rules do
(12)   Step 3.1. If r is a dependency rule, an agent Ag depends on at least one agent in the A′ set, do
(13)    Step 3.1.1. If , Ag and Ag′ the corresponding platforms are different in WP, do
(14)     Reset WP = ;
(15);      return to step 2 and decide on the next temporary migration plan
(16)   Step 3.2. If r is the atomic rule, all agents must be migrated to the same platform, do
(17)    Step 3.2.1. If , do
(18)     Reset WP = ;
(19);      return to step 2 and decide on the next temporary migration plan
(20)   Step 3.3. If r is an exclusivity rule, that is, two or more agents cannot migrate to the same platform, do
(21)    Step 3.3.1. If , do
(22)     Reset WP = ;
(23);      Return to step 2 and decide on the next temporary migration plan
(24)  Step 4. If the temporary migration plan WP meets all of the constraints rule R, do
(25)   Step 4.1. If , do
(26)    Step 4.1.1. Add platform to agent ’s migration destination host
(27)     dispatch(.Ip);
(28);     Migration_flag = true
(29)  Step 5. Else, do
(30)   Step 5.1. If there were more resources, do
(31)
(32)  ifthen
(33)   sumStep++;
(34)   Return to step 1, update the weights between nodes, and recalculate the migration factor;
(35)  else
(36)    Migration_flag = false;
(37)   end if
(38)end for
(39)  Return Migration_flag
(40)end for