Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalidServerSeq is returned when the given server seq greater than // the initial server seq. ErrInvalidServerSeq = errors.New("invalid server seq") )
Functions ¶
func NewPushPullKey ¶ added in v0.1.6
NewPushPullKey creates a new sync.Key of PushPull for the given document.
Types ¶
type ServerPack ¶ added in v0.1.10
type ServerPack struct { // DocumentKey is key of the document. DocumentKey *key.Key // Checkpoint is used to determine the client received changes. Checkpoint *checkpoint.Checkpoint // ChangeInfos represents a unit of modification in the document. ChangeInfos []*db.ChangeInfo // 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 }
ServerPack is similar to change.Pack, but has ChangeInfos instead of Changes to reduce type conversion in Agent.
func NewServerPack ¶ added in v0.1.10
func NewServerPack( key *key.Key, cp *checkpoint.Checkpoint, changeInfos []*db.ChangeInfo, snapshot []byte, ) *ServerPack
NewServerPack creates a new instance of ServerPack.
func PushPull ¶
func PushPull( ctx context.Context, be *backend.Backend, clientInfo *db.ClientInfo, docInfo *db.DocInfo, reqPack *change.Pack, ) (*ServerPack, error)
PushPull stores the given changes and returns accumulated changes of the given document.
func (*ServerPack) ChangesLen ¶ added in v0.1.10
func (p *ServerPack) ChangesLen() int
ChangesLen returns the size of the changes.
func (*ServerPack) OperationsLen ¶ added in v0.1.10
func (p *ServerPack) OperationsLen() int
OperationsLen returns the size of the operations.
func (*ServerPack) SnapshotLen ¶ added in v0.1.10
func (p *ServerPack) SnapshotLen() int
SnapshotLen returns the size of the snapshot.
func (*ServerPack) ToPBChangePack ¶ added in v0.1.10
func (p *ServerPack) ToPBChangePack() (*api.ChangePack, error)
ToPBChangePack converts the given model format to Protobuf format.
Click to show internal directories.
Click to hide internal directories.