144
Forthesereasons,thesimplestinterfacetoaPalimpseststore,andpossiblythebest
performingone,isaninterfacethatwillfacilitatethemanagementofanindependently
maintainedscreenbuffer.Generally,itiseasytogetaccesstofine-grainededitingevents
frommanyapplications,andmost“ready-made”textwidgets.
ThetwoprototypeVTMLeditorsthatIhavebuiltfollowedthisstrategywithsomesuc-
cess.Theinterfacetotheback-endprocess(whetherdirectorviaHTTP)operatedintermsof
characteroffsetsinthedisplaybuffer.Theeditingeventinformationrequiredtodrivethis
processwasrelativelyeasilyaccessibleinbothenvironments(Javatexteditingandthe
MacintoshOS).
insert(version,dest,string)
delete(version,start,end)
move(version,start,end,dest)
copy(version,start,end,dest)
registerNotifier(version,notifier)
Notifer.insert(version,dest,string)
Notifer.delete(version,start,end)
ChangeListgetChanges()
undo(Changechange)
redo(Changechange)
versiongetVersionHandle()
BuffergetContents(version)
F F F F iii ig g g gu u u ur r r re e e e 7777....3333:::: FFFFuuuunnnnccccttttiiiioooonnnnssss ffffoooorrrr mmmmaaaannnnaaaaggggiiiinnnngggg aaaa ppppaaaarrrraaaalllllllleeeellll bbbbuuuuffffffffeeeerrrr
ThefunctionsinFigure7.3alltakeaversionparameter:thisisauniquetokenrepre-
sentingaspecificstateoftheeditorbuffer.Theapplicationisresponsibleforpassingediting
eventstothePalimpsestimplementationusingthefirstfourmethods.Whenexternal
changesarrivefromcollaborators,theadjustmentstothestateofthedocumentarepre-
sentedtotheapplication’snotifierintheformofinsertionanddeletionevents.Thesame
mechanismisusedtoreflectbufferstatechangestotheapplicationwhenoperationssuchas
undoorredoareexecutedandcausethebufferstatetochange.Theversionandchange
145
functionsareexamplesofcollaborationsupportfunctionsthatcanbeprovidedevenwith
thissimplechange-reportinginterface.
Thiskindofsimpleinterfaceiseasytoimplementforapplicationwriters.Application
writersneednotevenbeawareofthedatareplicationthatcanoccurasaresultofthedata
cloningcausedbythecopyoperation.Whentheapplicationregistersachangeinacopy
source,appropriateupdatesaregeneratedfortheentireeditingbuffer.Itisimportantto
notethatforcopyinparticular,thereareafewpotentialperformanceproblemswiththis
kindofparallelbufferingarrangement.Onerelativelyunimportantproblemisthatthepo-
tentialsizeofadocumentwithncopyoperationscanbeexponentialinn.Moreserious(be-
causemorelikely)istheoverheadofprocessingupdatespropagatedbymultiplecopiesof
datainlargedocuments.Mostoftheapplicationswheredynamiccopyisusefulinvolvethe
useofboilerplatetext,whichislikelytobereplicatedmanytimes.Ifaneditingbuffercon-
taininganentiredocumentisbeingupdated,theapplicationmayspendasignificant
amountoftimeapplyingupdatestoportionsofthedocumentthatareinvisible.Whilethis
wouldnotbewastedwork(becausetheusermightscrolltothosepartsofthedocument),it
isworkthatcouldberadicallylimitedifitwereconfinedtothevisibleportionsofthe
document.Forlargedocumentswherecopyisacommonoperation,apartialbufferingstrat-
egybasedondirectaccesstothePalimpsestaddressingmechanismsseemstobenecessary.
7.3 Summary
ThischapterdescribesanarchitectureforPalimpsest-basedapplicationsthattakesadvan-
tageoftheopportunitiesprovidedbyachange-orienteddatadistributionmodeltoincrease
theflexibilityandconfigurabilityofcollaborativeapplications.Thisarchitectureabstracts
networkconnectionmanagementfromconcurrencycontrol,basedonthemergeanddistri-
butionguaranteesofferedbytheunderlyingPalimpsestmodel.Italsoseparatesmanyas-
pectsofdistributionstrategyfromdataconsistencyandconnectionmanagement.
Previous Page Next Page