138
eventthatpassesfromtheapplicationtothelocalstore.Thepolicymanagerisresponsible
foracceptingeventsfromwhatevernetworkconnectionsareavailable,andstoringthemin
thelocalstore.Changeeventsfromothercollaboratinginstancesoftheapplicationaredis-
patchedindirectlyviathepolicymanager.Thisnotonlyhidesdatastructuremaintenance,
butitencapsulatestheimplementationofupdatepoliciesinasingleplace.Thegrayarrows
representcontroloperationsfromtheapplicationtoselectpolicyoptionsorrequestapar-
ticularlevelofactivity.

Policy ManagerNetwork
Application
Local Store
F F F F iii ig g g gu u u ur r r re e e e 7777....1111:::: GGGGlllloooobbbbaaaallll AAAArrrrcccchhhhiiiitttteeeeccccttttuuuurrrreeee ffffoooorrrr PPPPaaaalllliiiimmmmppppsssseeeesssstttt aaaapppppppplllliiiiccccaaaattttiiiioooonnnnssss
ThisentirearchitectureisessentiallyseveralcomposedinstancesoftheObserverpattern
(Gamma,Helmetal.1995).Observerisawayofmodularizingupdatestostateinformation
bypassingthoseupdatestootherpartsofthesystemthatwouldbeaffectedbytheupdates.
Palimpsest’sdirectmanipulationofchangesmakesthispatternparticularlyusefulinthis
situation.ThepolicymanagercanalsobeseenasanapplicationoftheMediatorpattern,
139
which“promotesloosecouplingbykeepingobjectsfromreferringtoeachotherexplicitly.”
(Gamma,Helmetal.1995),p.273.
7.1.1 Thelocalstore
Thelocalstore,likeGaul,canbedividedintothreeparts,thepublicinterface(anin-
stanceoftheFaçadepattern(Gamma,Helmetal.1995)),thePalimpsestdatastoreitself,
andthepolicymanager.ThedatastorewasdiscussedinChapter6,anddespitesignificant
internalcomplexityitpresentsaverysimpleinterface.Figure7.2showthemostciritical
operationsthatalocalstoreneedstosupport.Alloftheseoperationsaresuitablefordirect
usebyanapplicationthatiswillingtomanageitsownchangeconflictsdirectly,ortotake
advantageofbuilt-inresolutionstrategies.Thefunctionslistedareselfexplanatory,forthe
mostpart.Wewillseelaterthatmostapplicationswillprobablyuseawrappedinterfacethat
issimplerandmayprovidebetterperformanceinhighlyinteractiveapplications.
Item[]getSegmentAt(Addressa,ChangeSetIDset)
Item[]contentsOf(Addressa,ChangeSetIDset)
Item[]contentsOf(Addressstart,Addressend,ChangeSetIDset)
SegmentIteratorenumerateContents(Addressa,ChangeSetIDset)
ConflictSetaddChange(ChangeIDid,ChangeSetIDset)
voidremoveChangeFromSet(ChangeIDid,ChangeSetIDset)
ChangeIDinsert(Item[],Addressdest)
ChangeIDdelete(Addressstart,Addressend)
ChangeIDcopy(Addressstart,Addressend,Addressdest)
ChangeIDmove(Addressstart,Addressend,Addressdest)
voidsetResolveConflicts(Booleanflag)
ChangeSetIteratorgetChangeSets()
ChangeIteratorgetChanges(ChangeSetIDset)
CorrelationMapcompare(ChangeSetIDversion1,ChangeSetIDversion2)
F F F F iii ig g g gu u u ur r r re e e e 7777....2222:::: CCCCoooommmmmmmmoooonnnn ooooppppeeeerrrraaaattttiiiioooonnnnssss ffffoooorrrr tttthhhheeee ddddaaaattttaaaa ssssttttoooorrrreeee
7.1.2 Thepolicymanager
Thepolicymanagermanagesapplicationconflicts,aswellasreplicationandeventpropa-
gation.Thepolicymanagerreceiveseverychangefromthelocalapplicationaswellasfrom
Previous Page Next Page