Fleet an effective system for publishsubscribe service over structured p2p networks
This presentation is the property of its rightful owner.
Sponsored Links
1 / 77

Fleet An Effective System for PublishSubscribe Service over Structured P2P Networks PowerPoint PPT Presentation


  • 93 Views
  • Uploaded on
  • Presentation posted in: General

Fleet An Effective System for PublishSubscribe Service over Structured P2P Networks. 蔡佳良 M9615041. Fleet LPNF-Name subscription_installation () algorithm. Fleet LPNF-Name publish_event () algorithm. aaa.scheme.

Download Presentation

Fleet An Effective System for PublishSubscribe Service over Structured P2P Networks

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Fleet an effective system for publishsubscribe service over structured p2p networks

Fleet An Effective System for PublishSubscribe Service over Structured P2P Networks

蔡佳良

M9615041


Fleet lpnf name subscription installation algorithm

Fleet LPNF-Namesubscription_installation() algorithm


Fleet lpnf name publish event algorithm

Fleet LPNF-Namepublish_event () algorithm


Aaa scheme

aaa.scheme

Name type min max end

Barhop float 1.000000 5000.000000 0

Budapest integer 1 5000 0

Buxton integer 1 5000 0

Chang integer 1 5000 0

Colombians integer 1 5000 0

Eriefloat 1.000000 5000.000000 0

Finnegan float 1.000000 5000.000000 0

Flemishfloat 1.000000 5000.000000 0

Gambiainteger 1 5000 0

Laotianinteger 1 5000 0


Aaa subscription

aaa.subscription

astride 3842 5000 monolithic 2387.500000 5000.000000 radiations 1 2568 retractions 3179.0 3179.0

Laotian 1 687 retractions 1.000000 784.000000

bureaucracy 565 565 retractions 1.000000 3063.500000

aback 1.000000 1417.000000 graces 1.000000 4595.500000 pretends 1.000000 2630.500000

Colombians 1 4660 Erie 1422.000000 5000.000000 alternates 1771.000000 5000.000000

baptizing 1 4752 miners 1 4406 radiations 1 2160 victimized 1 1406

league 2783 5000 retractions 848.500000 5000.000000 tomography 516 5000

retractions 1.000000 3749.000000

abjections 1 675 astride 392 5000 centralize 1024 5000 cottonwood 2867.000000 5000.000000

Colombians 2898 5000 aback 1.000000 3437.500000 alternates 2654.500000 5000.000000

Name min max


Aaa event

aaa.event

aback 3169.000000 astronautics 366

mergers 2393 retractions 4782.500000 Laotian 1744 centralize 4798 league 2999 mergers 2132

moron 2994 retractions 2434.000000 Chang 4078 Colombians 2573

Laotian 3541 Mesopotamia 534 Riverview 4464 aback 1108.500000

alternates 2539.000000 astronautics 2247 cottonwood 1605.500000

exiled 4115.000000 graces 2042.000000 rectangles 2983.000000

refuses 3860.500000 retractions 2203.000000 snail 1753 solidifying 3388

tomography 3922 unintentionally 2759 regrouping 4204.500000 Colombians 3778

Mundt 4966 alternates 3389.500000 appliance 3828.000000

monolithic 2504.500000 retractions 636.000000 steeling 433.000000 to

mography 1620 aback 4117.000000 baptizing 908 cargo 800.500000

maximizes 3637.500000 mergers 2256 retractions 1266.500000 squeaked 3991.500000

retractions 3609.500000

truncated 445 victimized 3424 Colombians 896

aback 353.500000 mergers 1062 monolithic 4996.500000 moron 4470 pilers 1970 result 797.000000

retractions 3106.500000 squeaked 4225.000000

victimized 2063 concrete 2087 forwarder 924 graces 308.000000

league 1202 rectangles 1929.500000 retractions 2166.000000

tomography 4117 victimized 861 Finnegan 4092.500000

Laotian 3574 Rawlings 2611.000000 aback 1754.500000 baptizing 3377 campus 462.000000

forwarder 1840 monolithic 693.500000 moron 2549 retractions 2763.000000 tomography 1001 truncated 3750

Indulge 26 grist 39 Tomography 30

Name value


Data structure of scheme

Data Structure of Scheme

map<string, Attribute*> Scheme //一開始系統會讀入所有的attribute存在scheme中

class Attribute {//每個attribute 有他的最大最小值的範圍 還有他的型態

private:

string Smin;

string Smax;

double min;

double max;

bool value;

public:

string Name;

int type;

}

aaa.scheme:Barhop float 1.000000 5000.000000 0

Attribute1

{

name:Barhop

Min= 1.000000

max= 5000.000000

Type= float

}

map<string, Attribute*> Scheme={<Barhop, >,…}


Data structure of subscription

Data Structure of Subscription

class Subscription {

double SubscriberID;

set<Predicates*> pds;

}

一個subscription儲存的例子

aaa.subscription:

Laotian 1 687

retractions 1.000000 784.000000

SubscriberID=0.5842 (random選出)

set<Predicates*> ={(Laotian , retractions) }

set<Predicate*>={Laotian , retractions}

class Predicate {

string Smin;

string Smax;

double min;

double max;

bool value;

string attr;

}

attr=“Laotian ”

min=1

max=687

attr=“retractions”

min=1.000000

max=784.000000

class Predicates {

char op;

set<Predicate*> p;

}


Main program

Main program

  • 先選出RP node

    • 根據RP node個數,將整個網路切成等分,得到每個區間的大小(separate_range)

    • 由sourceKey開始,將之作為第一個RP node,然後sourceKey+ separate_range得到第二個RP node,依此類推

  • 讀取subscription file,然後隨機選node發佈,存到網路上

  • 開始讀取event file,然後隨機挑一node發佈event開始matching&deliver


Main program1

Main program

int main (int argc, char **argv) {

while (!finished) {

1.choose RP Node

2.subscriptions publish & install

3.event match & publish

}

}


1 rp node

1.挑選RP node

參數

NumOfSubStation:RP node個數

  • 1.1 根據RP node個數,將整個網路切成等分,得到每個區間的大小(separate_range)

  • 1.2 由sourceKey開始,將之作為第一個RP node,然後sourceKey+ separate_range得到第二個RP node,依此類推

sourceKey:挑選RP node的起始點,隨機決定


1 choose rp node

1.choose RP Node

Random 決定

set<double> chooseSubStationNodes(int NumOfSubStation, double sourceKey) {

set<double> subStation;//存最後選出來的RP node key

double separate_range = (double) 1 / NumOfSubStation; //將整個chord ring 切成N等分

map<double, VirtualServer*>::iterator p = vServers.lower_bound(sourceKey);//從sourceKey開始

if (p == vServers.end())

p = vServers.begin();

subStation.insert(p->first);

for (int i = 1; i < NumOfSubStation; i++) {

p = vServers.lower_bound((p->first + separate_range > 1.0) ? (p->first + separate_range - 1) : (p->first + separate_range));

if (p == vServers.end())

p = vServers.begin();

subStation.insert(p->first);

}

return subStation;

}

1.1

1.2

7 個 RP node

sourceKey

//每個等距選出一個Node 為 RP node

separate_range


Main program2

Main program

int main (int argc, char **argv) {

while (!finished) {

1.choose RP Node

2.subscriptions publish & install

3.event match & publish

}

}


2 subscriptions publish install

2. subscriptions publish & install

  • 2.1 分析subscription 是不是case1

  • 2.2 確定subscription 是case1 開始儲存

  • 2.3 分析subscription 是不是case2

  • 2.4 確定subscription 是case2 開始儲存

  • 2.5 其他case3 開始儲存


2 subscriptions publish install1

2.subscriptions publish & install

if(useFleetmethod2){

double subKey = s->first;//目前發布的subscription

Subscription *thisSub = s->second;

string thissubsAttr;

set<string> subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentExceptBoolofEqual(thisSub);

if (!subsComponent.empty()) {

continue;

}else{

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentNotHot(thisSub);

set<string> subsComponent2 = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

continue;

}else{

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

}

}

}

//分析是否有equality-type的 attribute

2.1

2.2

2.3

2.4

2.5


2 1 analysissubscomponentexceptboolofequal

2.1AnalysisSubsComponentExceptBoolofEqual

分析是否有equality-type的 attribute

set<string> VirtualServer::AnalysisSubsComponentExceptBoolofEqual(Subscription *s){

set<Predicates*> thisPds = s->getPredicates();

set<Predicate*> thisPd = (*(thisPds.begin()))->getPredicate();

set<string> subsComponents;

subsComponents.clear();

for (set<Predicate*>::iterator thisPdp = thisPd.begin(); thisPdp != thisPd.end(); thisPdp++) {//查看subscription中的每個attribute

Predicate *thisPred = *thisPdp;

string name=thisPred->attr;

if(Scheme.find(name)->second->type != 1 ){//string 必為equality-type

if(Scheme.find(thisPred->attr)->second->type==0&& subsComponents.find(thisPred->attr) == subsComponents.end()){

subsComponents.insert(thisPred->attr);

}elseif(Scheme.find(thisPred->attr)->second->type==2&& subsComponents.find(thisPred->attr) == subsComponents.end()){

if(thisPred->getmax()==thisPred->getmin())//double 若 min=max 則也屬於equality-type

subsComponents.insert(thisPred->attr);

}

}

}

return subsComponents;

}

string  type = 0

boolean  type = 1

double  type = 2


2 2 subscriptions publish install

2.2 subscriptions publish & install

aaa.subscription:

bureaucracy 565 565

retractions 1.000000 3063.500000

if(useFleetmethod2){

double subKey = s->first;

Subscription *thisSub = s->second;

string thissubsAttr;

set<string> subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentExceptBoolofEqual(thisSub);

if (!subsComponent.empty()) {

continue;

}else{

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentNotHot(thisSub);

set<string> subsComponent2 = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

continue;

}else{

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

}

}

}

2.1

Hash(brueaucracy,565)

2.2

2.3

2.4

2.5

//case 1:此subscription至少有一個equal type 針對equality type處裡

// equality-type subscription :使用attribute name + value 為key 值 hash( name, value)


Fleet an effective system for publishsubscribe service over structured p2p networks

Case 1: Any one operator is an equality operator

1<retractions <3063.5

bureaucracy= 565

subscription

0.93

0.18

bureaucracy= 565

0.82

0.38

0.39

0.71

install

0.44

0.64

0.46

0.63

0.51

0.59


2 2 subscription equal type equality type

2.2 subscription至少有一個equal type 針對equality type處裡

  • 2.2.1 hash(name,value) 找出subscription要存在哪個SSM node

  • 2.2.2 routing到SSM node 然後將subscription存入


Fleet an effective system for publishsubscribe service over structured p2p networks

2.2equality-type subscription :使用name + value 為key 值 hash( name, value)

aaa.subscription:

bureaucracy 565 565

retractions 1.000000 3063.500000

if (!subsComponent.empty()) {

int whichattribute=rand()%subsComponent.size();

int choosedattributetype=getattributetype((*thisPdit)->attr);

//分析此attribute為string type or value type

if(choosedattributetype==0){//若為string type attribute

string hashstring=(*thisPdit)->attr+(*thisPdit)->getSmax();

pickKEYofSubscription=returnHashStringToNode(hashstring);

//hash( name + value)

} elseif(choosedattributetype==2){//若為value type attribute

sprintf(temp, "%f", (*thisPdit)->getmax());

string s(temp);

string hashstring=(*thisPdit)->attr+s;

pickKEYofSubscription=returnHashStringToNode(hashstring);

//hash( name + value)

}

bool routeSuccess = vServers[thisSub->getSubscriberID()]->customer_route(pickKEYofSubscription, notDisplay);

//從publish node 傳subscription到 pick node

if (routeSuccess) {

vServers[pickKEYofSubscription]->fleetaddSubs(subKey,thissubsAttr,thisSubsValue);

}

}

Hash(brueaucracy,565)

2.2.1

pickKEYofSubscription

Publish node

2.2.2

pickKEYofSubscription

install

找到node後 將subscription存入

Hash(name+value)找出要存放subscription的node


2 3 subscriptions publish install

2.3.subscriptions publish & install

if(useFleetmethod2){

double subKey = s->first;//目前發布的subscription

Subscription *thisSub = s->second;

string thissubsAttr;

//分析是否有equality-type的 attribute

set<string> subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentExceptBoolofEqual(thisSub);

if (!subsComponent.empty()) {//此subscription至少有一個equal type

…// equality-type subscription:使用attribute name + value 為key 值 hash( name, value)

continue;

}else{

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentNotHot(thisSub);

//分析是否存在非熱門的attribute

set<string> subsComponent2 = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

//分析是否存在熱門的attribute

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

…//所有attribute皆為熱門attribute使用Kautz Graph

continue;

}else{

//挑選出非熱門attribute set中 其value 範圍值最小之attribute

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

}

//range-query-type subscription:分割value值成value1,value2,…,valuen ,

//用attribute name + valuei為key值 hash(name, valuei) 然後複製N份subscriptions存在系統

}

}

先判斷是不是熱門的attribute

2.1

2.2

2.3

2.4

2.5

//處理range-query-type subscription


2 3 analysissubscomponentnothot analysissubscomponent

2.3AnalysisSubsComponentNotHotAnalysisSubsComponent

aaa.subscription:

astride 3842 5000

monolithic 2387.500000 5000.000000

radiations 1 2568

retractions 3179.000000 3179.000000

set<string> VirtualServer::AnalysisSubsComponentNotHot(Subscription *s) {

for (set<Predicate*>::iterator thisPdp = thisPd.begin(); thisPdp != thisPd.end(); thisPdp++) {

Predicate *thisPred = *thisPdp;

if(AttributeToIndex(thisPred->attr) < 0 && subsComponents.find(thisPred->attr) == subsComponents.end())

subsComponents.insert(thisPred->attr);

}

return subsComponents;

}

set<string> VirtualServer::AnalysisSubsComponent(Subscription *s) {

for (set<Predicate*>::iterator thisPdp = thisPd.begin(); thisPdp != thisPd.end(); thisPdp++) {

Predicate *thisPred = *thisPdp;

if(AttributeToIndex(thisPred->attr) >= 0 && subsComponents.find(thisPred->attr) == subsComponents.end())

subsComponents.insert(thisPred->attr);

}

return subsComponents;

}

2.3.1

subsComponents:

astride 3842 5000

monolithic 2387.500000 5000.000000

radiations 1 2568

//挑出非熱門的attribute

2.3.2

subsComponents:

retractions 3179.000000 3179.000000

//挑出熱門的attribute

AttributeToIndex(name) >= 0  popular

AttributeToIndex(name) < 0  not popular

//挑出非熱門的attribute

2.3.1

2.3.2

//挑出熱門的attribute


2 4subscriptions publish install

2.4subscriptions publish & install

aaa.subscription:

retractions 1.000000 3749.000000

if(useFleetmethod2){

double subKey = s->first;//目前發布的subscription

Subscription *thisSub = s->second;

string thissubsAttr;

//分析是否有equality-type的 attribute

set<string> subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentExceptBoolofEqual(thisSub);

if (!subsComponent.empty()) {//此subscription至少有一個equal type

…// equality-type subscription :使用attribute name + value 為key 值 hash( name, value)

continue;

}else{//處理range-query-type subscription

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentNotHot(thisSub);

//分析是否存在非熱門的attribute

set<string> subsComponent2 = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

//分析是否存在熱門的attribute

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

…//

continue;

}else{

//挑選出非熱門attribute set中 其value 範圍值最小之attribute

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

}

// range-query-type subscription:分割value值成value1,value2,…,valuen ,

//用attribute name + valuei為key值 hash(name, valuei) 然後複製N份subscriptions存在系統

}

}

2.1

2.2

2.3

2.4

2.5

Case 2:所有attribute皆為熱門attribute使用Kautz Graph


Fleet an effective system for publishsubscribe service over structured p2p networks

Tomography

Case 2: All attributes are hot

1<retractions < 3749

subscription

0.93

0.18

retractions

21.75

0

100

install

0.38

0.39

0.71

0.44

0.64

0.46

0.63

0.51

0.59


2 4 kautz tree subscription tree root

2.4 使用kautz tree之前 先把subscription集中存入在tree root

  • 2.4.1 分析subscription 是屬於哪個kautz tree

  • 2.4.2 若找不到負責的kautz tree,則新增此kautz tree

  • 2.4.3 找到負責的kautz tree

  • 2.4.4 將subscription存入負責的kautz tree


Fleet an effective system for publishsubscribe service over structured p2p networks

2.4使用kautz tree之前 先把subscription集中存入在tree root

2.4.1

2.4.2

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

map<set<string> , double>::iterator spp = SPnodes.find(subsComponent);

if (spp == SPnodes.end()) {//若此熱門attribute尚未有負責的SP node

string concateSubs = "";

//挑選一個node作為此熱門attribute的SP node

for (set<string>::iterator scp = subsComponent.begin(); scp != subsComponent.end(); scp++)

concateSubs += *scp;

double mapToDHTnode = (double) (BKDRHash(concateSubs) % 1000000 + 1) / 1000000;

map<double, VirtualServer*>::iterator findsucc = vServers.lower_bound(mapToDHTnode);

while(!succ->SPNodeKautzSubs.empty()){

//SP node不重複挑選 ,分散loading

findsucc++;

succ = findsucc->second;

}

} else {//之前的subscription已有過此組合

succ = vServers[spp->second];

}

bool routeSuccess = vServers[thisSub->getSubscriberID()]->customer_route(succ->getKey(), notDisplay);

if (routeSuccess)

succ->addKautzSubs(subKey);

continue;

}

之前尚未建立這個kautz tree 新增一個

若這Kautz tree已經建立好了 就先將subs

存在root之後再分配到leaf

2.4.3

Publish node

2.4.4

1<retractions < 3749

Set(retraction)

Sp node for (retraction)

install


Subscriptions installation using kautz partition tree

Subscriptions installation using Kautz Partition Tree

  • 建立kautz tree


Definition

Definition

  • Kautz string: length kand base d

  • a string u1u2…ukwhere ui belongs to an alphabet of d + 1 symbols (0,l,2, . . , d}

  • ui≠ui+l (1 ≦ i ≦ k - 1)


Data structure of kautz node

Data Structure of Kautz Node

Add some structures in “Virtual Server” structure


Preparation

preparation

  • 取出前n名的組合

  • create Kautz Partition Tree

  • push Subscription to Kautz node


Fleet an effective system for publishsubscribe service over structured p2p networks

//記錄前n名組合

map<set<string> , double> chooseSP

//取出前n名的組合

chooseSP = getTopNComponent(TopN);

//create Kautz Partition Tree

createKautzTree(KautzDegree, KautzLength, chooseSP, Display);

voidcreateKautzTree(int degree, int length, map<set<string> , double> TopNComponents, bool display) {

for (map<set<string> , double>::iterator tncp = TopNComponents.begin(); tncp != TopNComponents.end(); tncp++) {//對於所有的組合都建立一棵樹

double rootKey = tncp->second;

VirtualServer *root = vServers[rootKey];//取出某組合的root

set<string> thisSubsComponent = tncp->first; //取出此組合

Attribute *attr = Scheme[*(thisSubsComponent.begin())]; //先取出此組合的其中一個attribute

double min = attr->getmin();

double max = attr->getmax();

double partOfQuota = (max - min) / (degree + 1);//欲切割這一層每一部分的大小

double thisMin = min;

double thisMax = min + partOfQuota;

set<double> choosedKey;

choosedKey.insert(rootKey);//記錄那些vs已經被選為這棵樹的node

map<int, double> branch; //記錄建立了那些分支

map<string, Predicate*> thisPred; //記錄被劃分的範圍

….續下頁


Fleet an effective system for publishsubscribe service over structured p2p networks

  • voidcreateKautzTree(int degree, int length, map<set<string> , double> TopNComponents, bool display) {

  • for (map<set<string> , double>::iterator tncp = TopNComponents.begin(); tncp != TopNComponents.end(); tncp++) {//對於所有的組合都建立一棵樹

  • …..(接續上一頁)

    • for (int i = 0; i <= degree; i++) { //第一層從ROOT開始切割

    • //隨機選擇一點,不能重複

    • map<double, VirtualServer*>::iterator vp= vServers.lower_bound(randPct());

    • while(choosedKey.find(vp->first) != choosedKey.end())

    • vp++;

    • branch[i] = vp->first;

    • choosedKey.insert(vp->first);//記錄那些vs已經被選為這棵樹的node

    • //配置此attribute的範圍

    • thisPred.clear();

    • thisPred[attr->Name] = new Predicate(attr->Name,thisMin,thisMax);

    • for(set<string>::iterator tscp = thisSubsComponent.begin();tscp != thisSubsComponent.end();tscp++){

    • if(attr->Name.compare(*tscp) == 0)

    • continue;

    • Attribute *otherAttr = Scheme[*tscp];

    • thisPred[*tscp] = new Predicate(otherAttr->Name,otherAttr->getmin(),otherAttr->getmax());

    • }

    • (vp->second->KautzPred)[thisSubsComponent] = thisPred; //儲存範圍至此node

    • thisMin = thisMax; //下一個兄弟node範圍開始值為前一個範圍的結束值

    • if(i != degree) //下一個兄弟node範圍結束值=前一個範圍的結束值+每一個切割的部分的大小

    • thisMax = thisMaX + partOfQuota;

    • else // 最後一個兄弟範圍的結束值為此attribute的最大值

    • thisMax = max;

    • }

    • (root->KautzBranch)[thisSubsComponent] = branch;

    • //每個CHILD各自去執行建立分支的動作

    • for(map<int,double>::iterator bp = branch.begin();bp != branch.end();bp++)

    • vServers[bp->second]->createSubKautzTree(degree, length, 1, bp->first, thisSubsComponent,display);

  • }

  • }

到這行為止的進度如下頁的圖


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度時,已經建立好一棵tree如下圖

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

createSubKautzTree(2, 4, 1, 0, <reractions,Tomography>, display)

Tomography

createSubKautzTree(2, 4, 1, 1, <reractions,Tomography>, display)

createSubKautzTree(2, 4, 1, 2, <reractions,Tomography>, display)

retraction

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

//每個CHILD各自去執行建立分支的動作

傳入參數:degree<->d

length <->base b

level <->目前建立的是第幾層

branch <->parent所屬的是那個分支(0,1,2,…)

subComponent<-> 建立的是那一種組合的node

voidVirtualServer::createSubKautzTree(int degree, int length, int level, int branch, set<string> subComponent, bool display) {

string attr = "";

//先選出目前是輪到組合中的那一個attribute

if(subComponent.size() > 1) {

int chooseComponent = level % subComponent.size();

int countOfComponent = 0;

for (set<string>::iterator scp = subComponent.begin(); scp != subComponent.end(); scp++, countOfComponent++)

if (countOfComponent == chooseComponent) {

attr = *scp;

break;

}

ASSERT(!attr.empty());

} else //此組合為single attribute

attr = *(subComponent.begin());

//建立分支,傳入參數只比此function多一個attr <-> 要分割範圍的attribute

createSubKautzTree(degree, length, level, branch, subComponent, attr, display);

}


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography?

Retraction?

Tomography

決定好要以哪個Attribute來建分割範圍

以這邊為例,因為已經跑過retraction,

所以換成Tomography

//建立分支

createSubKautzTree(2, 4, 1, [1,2], <reraction,Tomography>, “Tomography”, display)

retraction

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

//建立分支

voidVirtualServer::createSubKautzTree(int degree, int length, int level, int branch, set<string> subComponent, string attr, bool display) {

Predicate *thispred = KautzPred[subComponent][attr];

double min = thispred->getmin();

double max = thispred->getmax();

double partOfQuota = (max - min) / degree;

double thisMin = min;

double thisMax = min + partOfQuota;

map<int,double> thisBranch;

map<string,Predicate*> thisPred;

for (int i = 0; i <= degree; i++) {

if (i == branch)

continue;

//隨機選擇一點,不能重複

map<double, VirtualServer*>::iterator vp= vServers.lower_bound(randPct());

VirtualServer *thisKautzNode = vp->second;

While (thisKautzNode->KautzPred.find(subComponent) != thisKautzNode->KautzPred.end()

|| thisKautzNode->getKey() == SPnodes[subComponent]) {

vp++;

if (vp == vServers.end())

vp = vServers.begin();

thisKautzNode = vp->second;

}

//決定好這個分支要建立在那個vs上

thisBranch[i] = thisKautzNode->getKey();

…..(接下頁)


Fleet an effective system for publishsubscribe service over structured p2p networks

voidVirtualServer::createSubKautzTree(int degree, int length, int level, int branch, set<string> subComponent, string attr, bool display) {

…..

for (int i = 0; i <= degree; i++) {

…...(接續上一頁)

thisPred.clear();

//配置此attribute的範圍

thisPred[attr] = new Predicate(attr,thisMin,thisMax);

for (set<string>::iterator scp = subComponent.begin(); scp != subComponent.end(); scp++) {

if(attr.compare(*scp) == 0)

continue;

thisPred[*scp] = KautzPred[subComponent][*scp];

}

(thisKautzNode->KautzPred)[subComponent] = thisPred;

//配置下一個兄弟node的範圍起始與結束值

thisMin = thisMax;

if(i != degree)

thisMax = thisMin + partOfQuota;

else

thisMax = max;

}

KautzBranch[subComponent] = thisBranch;

level++; //配置完這層的node後就將level+1

if (level < length) //檢查是不是已經所有的level都配置完畢,沒有的話就回到選擇屬性的function

for(map<int,double>::iterator tbp = thisBranch.begin();tbp != thisBranch.end();tbp++)

vServers[tbp->second]->createSubKautzTree(degree, length, level, tbp->first, subComponent,display);

}


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

因為現在還沒到設定的最底層第4層,

所以繼續重複選Attribute與分割範圍

retraction

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

Tomography?

Retraction?

retraction

決定好要以哪個Attribute來建分割範圍

以這邊為例,因為已經跑過Tomography,

所以換成retraction

Tomography

createSubKautzTree(2, 4, 2, [0,2], <reraction,Tomography>,display)

createSubKautzTree(2, 4, 2, [0,2], <reraction,Tomography>,“retraction”, display)


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

createSubKautzTree(2, 4, 3, [1,2], <reraction,Tomography>,display)

retraction

Retraction?

Tomography?

決定好要以哪個Attribute來建分割範圍

以這邊為例,因為已經跑過retraction,

所以換成Tomography

Tomography

createSubKautzTree(2, 4, 3, [1,2], <reraction,Tomography>,“Tomography”, display)


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

retraction

已經到達設定的最底層第四層,

所以停止分割範圍

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

retraction

其他尚未執行完的建Tree動作

繼續執行

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

其他尚未執行完的建Tree動作

繼續執行

retraction

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

retraction

其他尚未執行完的建Tree動作

繼續執行

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

執行完到上一頁指定的進度

P(2,4)

retraction, Tomography

(66~99],[1~49.75]

[0~33],[1~49.75]

(33~66],[1~49.75]

1

0

2

[0~33],

[1~25.375]

[0~33],

(25.375~49.75]

(33~66],

(25.375~49.75]

(33~66],

[1~25.375]

(66~99],

[1~25.375]

(66~99],

(25.375~49.75]

10

12

01

02

20

21

(33~49.5],

(25.375~49.75]

(66~82.5],

(25.375~49.75]

[0~16.5],

(25.375~49.75]

(16.5~33],

[1~25.375]

(33~49.5],

[1~25.375]

(49.5~66],

[1~25.375]

[0~16.5],

[1~25.375]

(66~82.5],

[1~25.375]

(82.5~99],

[1~25.375]

(49.5~66],

(25.375~49.75]

(16.5~33],

(25.375~49.75]

(82.5~99],

(25.375~49.75]

101

102

120

121

010

012

020

021

201

202

210

212

1020

1012

1201

1210

1021

1202

1212

0120

1010

2020

0102

0201

0210

2012

2101

2120

0121

0202

2021

2102

0212

2121

0101

2010

retraction

Tomography

retraction

其他分支依照相同動作繼續下去

Tomography


Fleet an effective system for publishsubscribe service over structured p2p networks

//push Subscription to Kautz node

for (map<set<string> , double>::iterator cspp = chooseSP.begin(); cspp != chooseSP.end(); cspp++) {

//三棵建立好的空tree

double spKey = cspp->second;

VirtualServer *thisSp = vServers[spKey]; //取得某一棵樹的root

set<string> thisSubsComponent = cspp->first; //取得這是屬於那一個組合的tree

set<double> thisSubs = thisSp->subs;

for(set<double>::iterator subp = thisSubs.begin();subp != thisSubs.end();subp++){

//對於目前在root上所有的subscriptions

//取出此subscriptions的內容

Subscription* thisSub = SubsBASE[*subp];

set<Predicates*> thisPds = thisSub->getPredicates();

set<Predicate*> thisPd = (*(thisPds.begin()))->getPredicate();

map<string, double> lowValue,highValue;

//找出這個subscriptions的內容中屬於此組合的predicate

for (set<string>::iterator tscp = thisSubsComponent.begin(); tscp != thisSubsComponent.end(); tscp++) {

string thisAttr = *tscp;

for (set<Predicate*>::iterator thisPdp = thisPd.begin(); thisPdp != thisPd.end(); thisPdp++) {

Predicate *thisPred = *thisPdp;

if (thisAttr.compare(thisPred->attr) != 0)

continue;

lowValue[thisPred->attr] = thisPred->getmin();

highValue[thisPred->attr] = thisPred->getmax();

break;

}

}

…..(接下頁)

25<=retraction<50

2.5<=Tomography<10

取得 lowValue,highValue 的值

highValue

lowValue


Fleet an effective system for publishsubscribe service over structured p2p networks

//push Subscription to Kautz node

for (map<set<string> , double>::iterator cspp = chooseSP.begin(); cspp != chooseSP.end(); cspp++) {

….

for(set<double>::iterator subp = thisSubs.begin();subp != thisSubs.end();subp++){

…...(接續上一頁)

//取得下限值

string lowT = getKautzString(thisSubsComponent, lowValue, KautzLength, notDisplay);

//取得上限值

string highT = getKautzString(thisSubsComponent, highValue, KautzLength, notDisplay);

//包含下限值到上限值中間的所有Tree Node

set<string> DestCopyNode = getAllKautzString(lowT, highT, KautzDegree, notDisplay);

//將subscriptions 複製到Tree Node上

for (set<string>::iterator dcnp = DestCopyNode.begin(); dcnp != DestCopyNode.end(); dcnp++) {

//先取得欲設置subscription的vs的key

double dstVsKey = getKautzResponsibleKey(thisSubsComponent ,*dcnp);

(vServers[dstVsKey]->KautzSubs)[thisSubsComponent].insert(*subp);

}

}

thisSp->subs.clear();

}

先取得上下限值


Fleet an effective system for publishsubscribe service over structured p2p networks

string getKautzString(set<string> subsComponent, map<string, double> componentValue, int length , bool display) {

string T = "";

VirtualServer *componentVs = vServers[SPnodes[subsComponent]]; //取得組合的root

for (int i = 0; i < length; i++) {

map<int, double> thisBranch = (componentVs->KautzBranch)[subsComponent];

int thisBranchSize = thisBranch.size();

int countOfBranch = 1;

for (map<int, double>::iterator tbp = thisBranch.begin(); tbp != thisBranch.end(); tbp++,countOfBranch++) {

VirtualServer *thisBranchVs = vServers[tbp->second];

map<string, Predicate*> thisBranchPred = (thisBranchVs->KautzPred)[subsComponent];

bool isSatisified = true;

for (map<string, double>::iterator cvp = componentValue.begin(); cvp != componentValue.end(); cvp++) {

Predicate *thispred = thisBranchPred[cvp->first];

if (!(thispred->getmin() <= cvp->second && cvp->second <= thispred->getmax())) {

isSatisified = false;

break;

}

}

if (countOfBranch == thisBranchSize)

isSatisified = true;

if (isSatisified) {

T += int2str(tbp->first);

componentVs = thisBranchVs;

break;

}

}

}

ASSERT(!T.empty() && T.length() == (unsigned)length);

return T;

}

P(2,3)

root

[0~33],[0~49]

(33~66],[0~49]

(66~99],[0~49]

retraction

1

0

2

(66~99],

(24.5~49]

(66~99],

[0~24.5]

(33~66],

(24.5~49]

(33~66],

[0~24.5]

[0~33],

(24.5~49]

[0~33],

[0~24.5]

10

12

01

02

20

21

Tomography

(33~49.5],

[0~24.5]

[0~16.5],

[0~24.5]

[16.5~33],

[0~24.5]

(49.5~66],

[0~24.5]

101

102

120

121

010

012

020

021

201

202

210

212

retraction

lowValue

highValue

在這邊我們取得的是012與102


Fleet an effective system for publishsubscribe service over structured p2p networks

//push Subscription to Kautz node

for (map<set<string> , double>::iterator cspp = chooseSP.begin(); cspp != chooseSP.end(); cspp++) {

….

for(set<double>::iterator subp = thisSubs.begin();subp != thisSubs.end();subp++){

…...(接續上一頁)

//取得下限值

string lowT = getKautzString(thisSubsComponent, lowValue, KautzLength, notDisplay);

//取得上限值

string highT = getKautzString(thisSubsComponent, highValue, KautzLength, notDisplay);

//包含下限值到上限值中間的所有Tree Node

set<string> DestCopyNode = getAllKautzString(lowT, highT, KautzDegree, notDisplay);

//將subscriptions 複製到Tree Node上

for (set<string>::iterator dcnp = DestCopyNode.begin(); dcnp != DestCopyNode.end(); dcnp++) {

//先取得欲設置subscription的vs的key

double dstVsKey = getKautzResponsibleKey(thisSubsComponent ,*dcnp);

(vServers[dstVsKey]->KautzSubs)[thisSubsComponent].insert(*subp);

}

}

thisSp->subs.clear();

}

接著是把介於012與102之間的Tree Node找出來


Fleet an effective system for publishsubscribe service over structured p2p networks

set<string> getAllKautzString(string LowT, string HighT, int degree, bool display) {

set<string> tempComponentString;

tempComponentString.clear();

if (!LowT.empty()) tempComponentString.insert(LowT);

if (!HighT.empty()) tempComponentString.insert(HighT);

int *LOW = newint[LowT.length()];

for (int i = 0; (unsigned) i < LowT.length(); i++) LOW[i] = LowT[i] - 48;

int *HIGH = newint[HighT.length()];

for (int i = 0; (unsigned) i < HighT.length(); i++) HIGH[i] = HighT[i] - 48;

string thisGenT = "";

int bit = LowT.length() - 1;

if (LowT.compare(HighT) != 0) {

do {

thisGenT.clear();

LOW[bit]++;

for (int i = bit; i > 0; i--) {

if (LOW[i] <= degree)

break;

elseif (LOW[i] > degree) {

LOW[i] = LOW[i] % (degree + 1);

LOW[i - 1]++; }

}

bool legalstring = true;

for (int n = 1; (unsigned)n < LowT.length(); n++)

if (LOW[n] == LOW[n - 1]) {

legalstring = false;

break;

}

for (int k = 0; (unsigned)k < LowT.length(); k++)

thisGenT += int2str(LOW[k]);

ASSERT(!thisGenT.empty());

if (legalstring && tempComponentString.find(thisGenT) == tempComponentString.end())

tempComponentString.insert(thisGenT);

} while (thisGenT.compare(HighT) != 0);

}

return tempComponentString;

}

先把012到102用三進位的方式列出所有的數字

去掉數字中有任兩相鄰的位數數字一樣者


Fleet an effective system for publishsubscribe service over structured p2p networks

由getAllKautzString()所運算出來的節點剛好就是底下括弧裡的節點

212

101

120

021

102

25<=retraction<50

2.5<=Tomography<10

Hash

202

retraction

010

Subscriptions

020

P(2,3)

210

201

root

012

[0~33],[0~49]

(33~66],[0~49]

(66~99],[0~49]

121

retraction

1

0

2

(66~99],

(24.5~49]

(66~99],

[0~24.5]

(33~66],

(24.5~49]

(33~66],

[0~24.5]

[0~33],

(24.5~49]

[0~33],

[0~24.5]

10

12

01

02

20

21

Tomography

(33~49.5],

[0~24.5]

[0~16.5],

[0~24.5]

[16.5~33],

[0~24.5]

(49.5~66],

[0~24.5]

101

102

120

121

010

012

020

021

201

202

210

212

retraction

Put this subscription to each of these nodes


Fleet an effective system for publishsubscribe service over structured p2p networks

//push Subscription to Kautz node

for (map<set<string> , double>::iterator cspp = chooseSP.begin(); cspp != chooseSP.end(); cspp++) {

….

for(set<double>::iterator subp = thisSubs.begin();subp != thisSubs.end();subp++){

…...(接續上一頁)

//取得下限值

string lowT = getKautzString(thisSubsComponent, lowValue, KautzLength, notDisplay);

//取得上限值

string highT = getKautzString(thisSubsComponent, highValue, KautzLength, notDisplay);

//包含下限值到上限值中間的所有Tree Node

set<string> DestCopyNode = getAllKautzString(lowT, highT, KautzDegree, notDisplay);

//將subscriptions 複製到Tree Node上

for (set<string>::iterator dcnp = DestCopyNode.begin(); dcnp != DestCopyNode.end(); dcnp++) {

//先取得欲設置subscription的vs的key

double dstVsKey = getKautzResponsibleKey(thisSubsComponent ,*dcnp);

(vServers[dstVsKey]->KautzSubs)[thisSubsComponent].insert(*subp);

}

}

thisSp->subs.clear();

}

利用剛才所找到節點的id來取得vs的key放置subscriptions


Fleet an effective system for publishsubscribe service over structured p2p networks

doublegetKautzResponsibleKey(set<string> subsComponent ,string T) {

double returnKey = -1;

VirtualServer *componentVs = vServers[SPnodes[subsComponent]];

for (int i = 0; (unsigned) i < T.length(); i++) {

double nextVsKey = (componentVs->KautzBranch)[subsComponent][T[i] - 48];

componentVs = vServers[nextVsKey];

}

returnKey = componentVs->getKey();

ASSERT(returnKey >= 0);

return returnKey;

}

212

101

120

021

102

202

retraction

010

25<=retraction<50

2.5<=Tomography<10

020

210

每找到此id對應的vs就複製此subscriptions到這些點上

201

Subscriptions

012

121


2 5 subscriptions publish install

2.5 subscriptions publish & install

aaa.Subscription:

aback 1.000000 1417.000000

graces 1.000000 4595.500000

pretends 1.000000 2630.500000

if(useFleetmethod2){

double subKey = s->first;//目前發布的subscription

Subscription *thisSub = s->second;

string thissubsAttr;

//分析是否有equality-type的 attribute

set<string> subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentExceptBoolofEqual(thisSub);

if (!subsComponent.empty()) {//此subscription至少有一個equal type

…// equality-type subscription :使用attribute name + value 為key 值 hash( name, value)

continue;

}else{//處理range-query-type subscription

subsComponent = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentNotHot(thisSub);

//分析是否存在非熱門的attribute

set<string> subsComponent2 = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponent(thisSub);

//分析是否存在熱門的attribute

if(useKautzPartitionTree && subsComponent.empty() && !subsComponent2.empty()){

…//所有attribute皆為熱門attribute 使用Kautz Graph

continue;

}else{

//挑選出非熱門attribute set中 其value 範圍值最小之attribute

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

}

// range-query-type subscription:分割value值成value1,value2,…,valuen ,

//用attribute name + valuei為key值 hash(name, valuei) 然後複製N份subscriptions存在系統

}

}

2.1

2.2

choose

2.3

2.4

2.5

針對subscription Case 3的subscription 處裡


Fleet an effective system for publishsubscribe service over structured p2p networks

Case 3: Any attribute combination is cold

1 < aback < 1417

1 < graces < 4595

1 < pretends< 2630

subscription

0.93

Aback<1417

0.18

1417

0.82

0

300

900

5000

1500

600

1200

0.38

install

0.39

0.71

install

0.44

install

0.64

0.46

install

0.63

0.51

install

0.59


2 5 subscription

2.5處理非熱門的 subscription

  • 2.5.1 先挑選出value範圍最小的attribute:A

  • 2.5.2 找出A的最大值跟最小值

  • 2.5.3 取得分割A的起點

  • 2.5.4 判斷A的範圍是否有落在起點,若有複製一份subscription存入

  • 2.5.5 將A範圍內的每個點都複製一份subscription


2 5 1 analysissubscomponentwitheminrange

2.5.1AnalysisSubsComponentwitheMinRange

string VirtualServer::AnalysisSubsComponentwitheMinRange(Subscription *s){///[catkill]

Predicate *minPred;//MinRange attribute

for (set<Predicate*>::iterator thisPdp = thisPd.begin(); thisPdp != thisPd.end(); thisPdp++) {

Predicate *thisPred = *thisPdp;

string name=thisPred->attr;

if(((thisPred->getmax()-thisPred->getmin()) <(minPred->getmax()-minPred->getmin()))){

minPred=*thisPdp;

}

}

string theMinRangeName=(*minPred).attr;

ASSERT(theMinRangeName.compare("NULL")!=0);

return (*minPred).attr;

}

找出範圍最小的attribute


Fleet an effective system for publishsubscribe service over structured p2p networks

//取得value的範圍 以方便分割

2.5.1

1 < aback < 1417

1 < graces < 4595

1 < pretends< 2630

2.5.2

選出value範圍值最小者

Component = vServers[thisSub->getSubscriberID()]->AnalysisSubsComponentwitheMinRange(thisSub);

//找出其value range為最小的attribute,以得最少複製

double thisAttMax=Scheme.find(thisPred->attr)->second->getmax();

double thisAttmin=Scheme.find(thisPred->attr)->second->getmin();

int IIMstartValue = BKDRHash(thisPred->attr) % 10 + 1;

//假設value 的範圍為0~100,未避免key值為0的subscription過多

//依據attribute name設定分割起始點,將同一類的subscription更分散地儲存

double interval=(thisAttMax-thisAttmin)/IIMinterval;

if(IIMstartValue>=thisPred->getmin() && 0<= string hashstring=(*thisPditthisPred->getmax()){

string hashstring=(*thisPdit)->attr+s;

pickKEYofSubscription=returnHashStringToNode(hashstring);

bool routeSuccess = vServers[thisSub->getSubscriberID()]->customer_route(pickKEYofSubscription,notDisplay);

if(routeSuccess) {

vServers[pickKEYofSubscription]->fleetaddSubs(subKey,thissubsAttr,thisSubsValue);

}

}

for(double i=IIMstartValue;i<thisAttMax;i+=interval){//

if((i+interval)>=thisPred->getmin() && i<=thisPred->getmax()){

string hashstring=(*thisPdit)->attr+s;

pickKEYofSubscription=returnHashStringToNode(hashstring);

bool routeSuccess = vServers[thisSub->getSubscriberID()]->customer_route(pickKEYofSubscription,notDisplay);

if(routeSuccess) {

vServers[pickKEYofSubscription]->fleetaddSubs(subKey,thissubsAttr,thisSubsValue);

}

}

}

}

2.5.3

設定不同的起始點

1<aback<1417

//針對起始點為0的複製

每個attr的起始點不同

2.5.4

IIMstartValue=hash(aback)

1417

0

300

900

5000

1500

600

1200

2.5.5

Key=hash(aback,IIMstartValue)

Key=hash(aback,IIMstartValue+interval)

針對每個區間的複製

1<IIMstartValue+interval


Main program3

Main program

int main (int argc, char **argv) {

while (!finished) {

1.choose RP Node

2.subscriptions publish & install

3.event match & publish

}

}


3 event match publish

3.event match & publish

  • 3.1 判斷event中是否有熱門attribute,針對於熱門的attribute 傳遞event (case2)

  • 3.2 針對string type的subscription 傳遞event (case1)

  • 3.3 針對Value type運算員為等號的subscription 傳遞event (case1)

  • 3.4 針對非熱門的subscription傳遞event (case3)


3 event match publish1

3.event match & publish

eventp = Events.begin();//目前發布的event

int getVsIndex = rand() % vServers.size();//random挑一個 node 發出event

eventCount++;

if(useKautzPartitionTree){

string thisEventAttr = thisEvent->EventIdentifyComponent();

//分析event是否含有熱門的attribute

}

if(useFleetmethod2){//

map<string, string> thisEventContent=thisEvent->getContent();

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

if(getattributetype((*thisEventAttribueit).first)==0){

//

} elseif(getattributetype((*thisEventAttribueit).first)==2){

//

}

}

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

//value type attribute針對range-query-type subscription執行event match & publish

}

}

3.1

Fleet針對熱門的attribute執行event match & publish

string type attribute執行event match & publish

3.2

3.3

針對value type attribute的運算元為等號的部份執行event match & publish

3.4

Value type attribute的分割

Fleet針對非熱門的attribute執行event match & publish


Event match publish

event match & publish

aaa.Event

Indulge = 26

grist = 39

Tomography=30

eventp = Events.begin();//目前發布的event

double eventKey = eventp->first;

Event *thisEvent = eventp->second;

int getVsIndex = rand() % vServers.size();//random挑一個 node 發出event

eventCount++;

if(useKautzPartitionTree){

string thisEventAttr = thisEvent->EventIdentifyComponent();

//分析event是否含有熱門的attribute

}

if(useFleetmethod2){//Fleet針對非熱門的attribute執行event match & publish

map<string, string> thisEventContent=thisEvent->getContent();

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

if(getattributetype((*thisEventAttribueit).first)==0){

//string type attribute執行event match & publish

} elseif(getattributetype((*thisEventAttribueit).first)==2){

//value type attribute針對equality-type subscription執行event match & publish

}

}

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

//value type attribute針對range-query-type subscription執行event match & publish

}

}

Hash(Tomography)

3.1

3.2

Tompgraphy

3.3

3.4

Fleet針對熱門的attribute執行event match & publish


Fleet an effective system for publishsubscribe service over structured p2p networks

Tomography

Partition tree root node

event

Match

aaa.Event

node

0.93

Indulge = 26

grist = 39

Tomography=30

publisher

0.18

0.82

Match

0.38

Case 2 event publish

0.39

0.71

0.44

Match

0.64

0.46

Match

0.63

0.51

Match

0.59

Match


3 1 attribute event

3.1 針對熱門attribute傳遞event

  • 3.1.1 將event傳至SP node並計算總共的hops

  • 3.1.2 透過kautz tree找到存subscription的leaf

  • 3.1.3 幫leaf上的每個subscription分類,看是屬於哪個RP node負責的

  • 3.1.4 matching&deliver


Fleet an effective system for publishsubscribe service over structured p2p networks

計算event 到sp node的hops

3.1.1

if(useKautzPartitionTree){

string thisEventAttr = thisEvent->EventIdentifyComponent();//取出熱門的attribute

for (map<set<string> , double>::iterator spp = SPnodes.begin(); spp != SPnodes.end(); spp++) {

if (thisEventAttr.compare(“NOT_TOP_10”) == 0)//找到負責此熱門attribute的SPnode

break;

double spKey = spp->second;

int eventToNodeHops=srcVs->sendEventtoNode(eventKey,spKey,notDisplay);//將event傳遞到SPnode

Events[eventKey]->AddSendInfo(spKey,eventToNodeHops);//紀錄event publish node到 SP node 總共花費多少hops

VirtualServer *thisSp = vServers[spKey];

if (useFerryAsSubroutine) {

set<double> SubsOfThisSp;

map<string, string> thisEventContent = thisEvent->getContent();

//取得熱門的attribute set

string kautzT = getKautzString(thisSubsComponent, componentValue,KautzLength, notDisplay);

//算出kautz路徑

double goalOfNode = getKautzResponsibleKey(thisSubsComponent, kautzT);

//找到目標的樹葉節點

SubsOfThisSp = (thisSp->KautzSubs)[thisSubsComponent]; //取得存在這node的subscription

for (set<double>::iterator subp = SubsOfThisSp.begin(); subp != SubsOfThisSp.end(); subp++) {

//幫每個subscription找出所在的address space

pickKEYofSubscription = PredRP(thisSub->getSubscriberID(), notDisplay);

TempSubsBox[pickKEYofSubscription].insert(*subp);

}

for (map<double, Attribute*>::iterator rpp = RPnode.begin(); rpp != RPnode.end(); rpp++) {

thisSp->createMatchIDList(eventKey, TempSubsBox[rpKey], notDisplay);//event在樹葉節點match

Events[eventKey]->AddSendInfo(rpKey, 1);//SP node 到 RP node 花費 1 hop

thisRP->createIDMatchTree(eventKey, thisSp->MatchIDList, notDisplay);//RP node收到match list建立match tree

thisRP->deliverEvent(eventKey, baseHops, notDisplay);//RP node傳event至每個match的subscriber

}

}

}

}

Event

SP node

n hops

3.1.2

1 hops

n hops

3.1.3

subscriber

RP node

3.1.4

在leaf 比對完後將比對結果傳給RP每,個RP 開始傳遞event

找出subs是屬於哪個RP node負責

找出要發送event的leaf


Event match publish1

event match & publish

eventp = Events.begin();//目前發布的event

double eventKey = eventp->first;

Event *thisEvent = eventp->second;

int getVsIndex = rand() % vServers.size();//random挑一個 node 發出event

eventCount++;

if(useKautzPartitionTree){Fleet針對熱門的attribute執行event match & publish

string thisEventAttr = thisEvent->EventIdentifyComponent();

//分析event是否含有熱門的attribute

}

if(useFleetmethod2){//Fleet針對非熱門的attribute執行event match & publish

map<string, string> thisEventContent=thisEvent->getContent();

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

if(getattributetype((*thisEventAttribueit).first)==0){

//string type attribute執行event match & publish

} elseif(getattributetype((*thisEventAttribueit).first)==2){

//value type attribute針對equality-type subscription執行event match & publish

}

}

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

//value type attribute針對range-query-type subscription執行event match & publish

}

}

3.1

3.2

3.3

3.4

Case1 :當attribute type為string時的case 1 event publish


Fleet an effective system for publishsubscribe service over structured p2p networks

Tomography

Partition tree root node

event

Match

aaa.Event

node

0.93

Indulge = 26

grist = 39

Tomography=30

publisher

0.18

0.82

Match

Case 1 event publish

0.38

0.39

0.71

0.44

Match

0.64

0.46

Match

0.63

0.51

Match

0.59

Match


3 2 string type subscription event case1

3.2針對string type的subscription 傳遞event (case1)

  • 3.2.1 找出負責的SSM node

  • 3.2.2 matching & deliver


Fleet an effective system for publishsubscribe service over structured p2p networks

Event

Pick node

n hops

1 hops

n hops

subscriber

RP node

計算event到SSM node

的hops

3.2.1

if(getattributetype((*thisEventAttribueit).first)==0){

pickKEYofEvent=returnHashStringToNode(hashstring);//hash(name, value) ,找出SSM node

Events[eventKey]->AddSendInfo(pickKEYofEvent,eventToNodeHops);

//紀錄event publish node到pick node 花費多少hops

for (set<double>::iterator subp = SubsOfThisSp.begin(); subp != SubsOfThisSp.end(); subp++) {

//幫每個subscription找出所在的address space

pickKEYofSubscription = PredRP(thisSub->getSubscriberID(), notDisplay);

TempSubsBox[pickKEYofSubscription].insert(*subp);

}

int MatchIDLISTnubmer=0;

for (map<double, Attribute*>::iterator rpp = RPnode.begin(); rpp != RPnode.end(); rpp++) {

double rpKey = rpp->first;

Events[eventKey]->AddSendInfo(rpKey, 1);//pick node 到RP node 算 1 hop

thisSp->createMatchIDList(eventKey, TempSubsBox[rpKey], notDisplay);

//event在樹葉節點match

thisRP->createIDMatchTree(eventKey, thisSp->MatchIDList, notDisplay);

//RP node收到match list建立match tree

thisRP->deliverEvent(eventKey, baseHops, notDisplay);

//RP node傳event至每個match的subscriber

}

}

3.2.2

Event matching / deliver


Event match publish2

event match & publish

eventp = Events.begin();//目前發布的event

double eventKey = eventp->first;

Event *thisEvent = eventp->second;

int getVsIndex = rand() % vServers.size();//random挑一個 node 發出event

eventCount++;

if(useKautzPartitionTree){Fleet針對熱門的attribute執行event match & publish

string thisEventAttr = thisEvent->EventIdentifyComponent();

//分析event是否含有熱門的attribute

}

if(useFleetmethod2){//Fleet針對非熱門的attribute執行event match & publish

map<string, string> thisEventContent=thisEvent->getContent();

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

if(getattributetype((*thisEventAttribueit).first)==0){

//string type attribute執行event match & publish

} elseif(getattributetype((*thisEventAttribueit).first)==2){

//value type attribute針對equality-type subscription執行event match & publish

}

}

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

//value type attribute針對range-query-type subscription執行event match & publish

}

}

3.1

3.2

3.3

3.4

Case 1:當attribute為value type時的case 1 event publish


Fleet an effective system for publishsubscribe service over structured p2p networks

Tomography

Partition tree root node

event

Match

node

aaa.Event

0.93

Indulge = 26

grist = 39

Tomography=30

publisher

0.18

0.82

Match

Case 1 event publish

0.38

0.39

0.71

0.44

Match

0.64

0.46

Match

0.63

0.51

Match

0.59

Match


3 3 value type subscription event case1

3.3針對Value type運算員為等號的subscription 傳遞event (case1)

  • 3.3.1 找出負責的SSM node

  • 3.3.2 matching & deliver


Fleet an effective system for publishsubscribe service over structured p2p networks

Event

Pick node

n hops

1 hops

n hops

subscriber

RP node

計算event送到SSM node 的hops

3.3.1

elseif(getattributetype((*thisEventAttribueit).first)==2){

string hashstring=thisEventAttribueit->first+s2;

pickKEYofEvent=returnHashStringToNode(hashstring);

//hash(name,value)找到pick node

Events[eventKey]->AddSendInfo(pickKEYofEvent,eventToNodeHops);

//紀錄event deliver to pick node的 hops

for (set<double>::iterator subp = SubsOfThisSp.begin(); subp != SubsOfThisSp.end(); subp++) {

//幫每個subscription找出所在的address space

pickKEYofSubscription = PredRP(thisSub->getSubscriberID(), notDisplay);

}

for (map<double, Attribute*>::iterator rpp = RPnode.begin(); rpp != RPnode.end(); rpp++) {

thisSp->createMatchIDList(eventKey, TempSubsBox[rpKey], notDisplay);

//event在樹葉節點match

thisRP->createIDMatchTree(eventKey, thisSp->MatchIDList, notDisplay);

//RP node收到match list建立match tree

thisRP->deliverEvent(eventKey, baseHops, notDisplay);

//RP node傳event至每個match的subscriber

}

}

3.3.2

Event matching / deliver


Event match publish3

event match & publish

eventp = Events.begin();//目前發布的event

double eventKey = eventp->first;

Event *thisEvent = eventp->second;

int getVsIndex = rand() % vServers.size();//random挑一個 node 發出event

eventCount++;

if(useKautzPartitionTree){Fleet針對熱門的attribute執行event match & publish

string thisEventAttr = thisEvent->EventIdentifyComponent();

//分析event是否含有熱門的attribute

}

if(useFleetmethod2){//Fleet針對非熱門的attribute執行event match & publish

map<string, string> thisEventContent=thisEvent->getContent();

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

if(getattributetype((*thisEventAttribueit).first)==0){

//string type attribute執行event match & publish

} elseif(getattributetype((*thisEventAttribueit).first)==2){

//value type attribute針對equality-type subscription執行event match & publish

}

}

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

//value type attribute針對range-query-type subscription執行event match & publish

}

}

3.1

3.2

3.3

3.4

Case 3 :使用分割找出subscription所存在的node


Subscription event case3

針對非熱門的subscription傳遞event (case3)

  • 3.4.1 取得event attribute的最大最小值 與 此attribute分割的起始點

  • 3.4.2 判斷event value 是否落在起始點負責的範圍 ,若在這區塊則傳遞event進行matching & deliver

  • 3.4.3 找出event value 所落在的範圍,然後傳遞event進行matching & deliver


Fleet an effective system for publishsubscribe service over structured p2p networks

Event

Pick node

n hops

1 hops

n hops

subscriber

RP node

3.4.1

去判斷event所在的區間是否在起始點

若是則將event傳過去

for(map<string, string>::iterator thisEventAttribueit=thisEventContent.begin();thisEventAttribueit!=thisEventContent.end();thisEventAttribueit++){

double thisAttMax=Scheme.find(thisEventAttribueit->first)->second->getmax();

double thisAttmin=Scheme.find(thisEventAttribueit->first)->second->getmin();

double interval=(thisAttMax-thisAttmin)/IIMinterval;

//取得此attribute區間的大小

int IIMstartValue = BKDRHash(thisEventAttribueit->first) % 10 + 1;

//取得attribute name的分割起始點

if(0<=thisEventValue && IIMstartValue>thisEventValue){

//針對起始點的node,檢查event value是否在這區間,若有deliver event

string hashstring=thisEventAttribueit->first+s;

pickKEYofEvent=returnHashStringToNode(hashstring);

//hash(name,intervalValue),取得pick key

Events[eventKey]->AddSendInfo(pickKEYofEvent,eventToNodeHops);

//event publish node to pick node所需的hops數

for (set<double>::iterator subp = SubsOfThisSp.begin(); subp != SubsOfThisSp.end(); subp++) {

//幫每個subscription找出所在的address space

pickKEYofSubscription = PredRP(thisSub->getSubscriberID(), notDisplay);

}

for (map<double, Attribute*>::iterator rpp = RPnode.begin(); rpp != RPnode.end(); rpp++) {

thisSp->createMatchIDList(eventKey, TempSubsBox[rpKey], notDisplay);

//event在樹葉節點match

thisRP->createIDMatchTree(eventKey, thisSp->MatchIDList, notDisplay);

//RP node收到match list建立match tree

thisRP->deliverEvent(eventKey, baseHops, notDisplay);

//RP node傳event至每個match的subscriber

}

3.4.2


Fleet an effective system for publishsubscribe service over structured p2p networks

Event

Pick node

n hops

1 hops

n hops

subscriber

RP node

每個區間去比較,找出event所在的區間

3.4.3

IIMstartValue=hash(Indulge)

0

10

20

30

40

50

60

……..

for(double i=IIMstartValue;i<thisAttMax;i+=interval){

if(i<=thisEventValue && (i+interval)>thisEventValue){

//找出event value落在哪個區間內,然後deliver event

string hashstring=thisEventAttribueit->first+s;

pickKEYofEvent=returnHashStringToNode(hashstring);

//hash(name,intervalValue),取得pick key

Events[eventKey]->AddSendInfo(pickKEYofEvent,eventToNodeHops);

//event publish node to pick node所需的hops數

for (set<double>::iterator subp = SubsOfThisSp.begin(); subp != SubsOfThisSp.end(); subp++) {

//幫每個subscription找出所在的address space

pickKEYofSubscription = PredRP(thisSub->getSubscriberID(), notDisplay);

}

for (map<double, Attribute*>::iterator rpp = RPnode.begin(); rpp != RPnode.end(); rpp++) {

thisSp->createMatchIDList(eventKey, TempSubsBox[rpKey], notDisplay);

//event在樹葉節點match

thisRP->createIDMatchTree(eventKey, thisSp->MatchIDList, notDisplay);

//RP node收到match list建立match tree

thisRP->deliverEvent(eventKey, baseHops, notDisplay);

//RP node傳event至每個match的subscriber

}

}

}


  • Login