Documentation ¶
Index ¶
- Variables
- type Change
- func (c *Change) ClientSeq() uint32
- func (c *Change) Execute(root *json.Root) error
- func (c *Change) ID() *ID
- func (c *Change) Message() string
- func (c *Change) Operations() []operation.Operation
- func (c *Change) ServerSeq() uint64
- func (c *Change) SetActor(actor *time.ActorID)
- func (c *Change) SetServerSeq(serverSeq uint64)
- type Context
- func (c *Context) HasOperations() bool
- func (c *Context) ID() *ID
- func (c *Context) IssueTimeTicket() *time.Ticket
- func (c *Context) Push(op operation.Operation)
- func (c *Context) RegisterElement(elem json.Element)
- func (c *Context) RegisterRemovedElementPair(parent json.Container, deleted json.Element)
- func (c *Context) RegisterRemovedNodeTextElement(textType json.TextElement)
- func (c *Context) ToChange() *Change
- type ID
- type Pack
Constants ¶
This section is empty.
Variables ¶
var ( // InitialID represents the initial state ID. Usually this is used to // represent a state where nothing has been edited. InitialID = NewID(0, 0, time.InitialActorID) )
Functions ¶
This section is empty.
Types ¶
type Change ¶
type Change struct {
// contains filtered or unexported fields
}
Change represents a unit of modification in the document.
func (*Change) Operations ¶
Operations returns the operations of this change.
func (*Change) SetServerSeq ¶
SetServerSeq sets the given serverSeq.
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context is used to record the context of modification when editing a document. Each time we add an operation, a new time ticket is issued. Finally returns a Change after the modification has been completed.
func NewContext ¶
NewContext creates a new instance of Context.
func (*Context) HasOperations ¶
HasOperations returns whether this change has operations or not.
func (*Context) IssueTimeTicket ¶
IssueTimeTicket creates a time ticket to be used to create a new operation.
func (*Context) RegisterElement ¶
RegisterElement registers the given element to the root.
func (*Context) RegisterRemovedElementPair ¶ added in v0.1.1
RegisterRemovedElementPair registers the given element pair to hash table.
func (*Context) RegisterRemovedNodeTextElement ¶ added in v0.1.1
func (c *Context) RegisterRemovedNodeTextElement(textType json.TextElement)
RegisterRemovedNodeTextElement registers a given text type element to hash table.
type ID ¶
type ID struct {
// contains filtered or unexported fields
}
ID is for identifying the Change. This struct is immutable.
func (*ID) NewTimeTicket ¶
NewTimeTicket creates a ticket of the given delimiter.
func (*ID) SyncLamport ¶
SyncLamport syncs lamport timestamp with the given ID.
type Pack ¶
type Pack struct { // DocumentKey is key of the document. DocumentKey *key.Key // Checkpoint is used to determine the client received changes. Checkpoint *checkpoint.Checkpoint // Change represents a unit of modification in the document. Changes []*Change // Snapshot is a byte array that encode the document. Snapshot []byte // MinSyncedTicket is the minimum logical time taken by clients who attach the document. // It used to collect garbage on the replica on the client. MinSyncedTicket *time.Ticket }
Pack is a unit for delivering changes in a document to the remote.
func NewPack ¶
func NewPack( key *key.Key, cp *checkpoint.Checkpoint, changes []*Change, snapshot []byte, ) *Pack
NewPack creates a new instance of Pack.
func (*Pack) HasChanges ¶
HasChanges returns the whether pack has changes or not.