Documentation ¶
Index ¶
- Variables
- func BuildDocumentForServerSeq(ctx context.Context, be *backend.Backend, docInfo *database.DocInfo, ...) (*document.InternalDocument, error)
- func FindChanges(ctx context.Context, be *backend.Backend, docInfo *database.DocInfo, ...) ([]*change.Change, error)
- func PushPullKey(projectID types.ID, docKey key.Key) sync.Key
- func SnapshotKey(projectID types.ID, docKey key.Key) sync.Key
- type ServerPack
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 BuildDocumentForServerSeq ¶
func BuildDocumentForServerSeq( ctx context.Context, be *backend.Backend, docInfo *database.DocInfo, serverSeq int64, ) (*document.InternalDocument, error)
BuildDocumentForServerSeq returns a new document for the given serverSeq.
func FindChanges ¶ added in v0.2.11
func FindChanges( ctx context.Context, be *backend.Backend, docInfo *database.DocInfo, from int64, to int64, ) ([]*change.Change, error)
FindChanges fetches changes of the given document.
func PushPullKey ¶
PushPullKey creates a new sync.Key of PushPull for the given document.
Types ¶
type ServerPack ¶
type ServerPack struct { // DocumentKey is key of the document. DocumentKey key.Key // Checkpoint is used to determine the client received changes. Checkpoint change.Checkpoint // ChangeInfos represents a unit of modification in the document. ChangeInfos []*database.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 Server.
func NewServerPack ¶
func NewServerPack( key key.Key, cp change.Checkpoint, changeInfos []*database.ChangeInfo, snapshot []byte, ) *ServerPack
NewServerPack creates a new instance of ServerPack.
func PushPull ¶
func PushPull( ctx context.Context, be *backend.Backend, project *types.Project, clientInfo *database.ClientInfo, docInfo *database.DocInfo, reqPack *change.Pack, ) (*ServerPack, error)
PushPull stores the given changes and returns accumulated changes of the given document.
func (*ServerPack) ChangesLen ¶
func (p *ServerPack) ChangesLen() int
ChangesLen returns the size of the changes.
func (*ServerPack) OperationsLen ¶
func (p *ServerPack) OperationsLen() int
OperationsLen returns the size of the operations.
func (*ServerPack) SnapshotLen ¶
func (p *ServerPack) SnapshotLen() int
SnapshotLen returns the size of the snapshot.
func (*ServerPack) ToPBChangePack ¶
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.