Documentation ¶
Index ¶
- Variables
- type Client
- func (c *Client) ActivateClient(ctx context.Context, key string) (*db.ClientInfo, error)
- func (c *Client) Close() error
- func (c *Client) CreateSnapshotInfo(ctx context.Context, docID db.ID, doc *document.InternalDocument) error
- func (c *Client) DeactivateClient(ctx context.Context, clientID db.ID) (*db.ClientInfo, error)
- func (c *Client) FindChangeInfosBetweenServerSeqs(ctx context.Context, docID db.ID, from uint64, to uint64) ([]*change.Change, error)
- func (c *Client) FindClientInfoByID(ctx context.Context, clientID db.ID) (*db.ClientInfo, error)
- func (c *Client) FindDocInfoByKey(ctx context.Context, clientInfo *db.ClientInfo, bsonDocKey string, ...) (*db.DocInfo, error)
- func (c *Client) FindLastSnapshotInfo(ctx context.Context, docID db.ID) (*db.SnapshotInfo, error)
- func (c *Client) StoreChangeInfos(ctx context.Context, docInfo *db.DocInfo, initialServerSeq uint64, ...) error
- func (c *Client) UpdateAndFindMinSyncedTicket(ctx context.Context, clientInfo *db.ClientInfo, docID db.ID, serverSeq uint64) (*time.Ticket, error)
- func (c *Client) UpdateClientInfoAfterPushPull(ctx context.Context, clientInfo *db.ClientInfo, docInfo *db.DocInfo) error
- type Config
Constants ¶
This section is empty.
Variables ¶
var ( ColClients = "clients" ColDocuments = "documents" ColChanges = "changes" ColSnapshots = "snapshots" ColSyncedSeqs = "syncedseqs" )
Below are names and indexes information of collections that stores Yorkie data.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a client that connects to Mongo DB and reads or saves Yorkie data.
func (*Client) ActivateClient ¶
ActivateClient activates the client of the given key.
func (*Client) CreateSnapshotInfo ¶
func (c *Client) CreateSnapshotInfo( ctx context.Context, docID db.ID, doc *document.InternalDocument, ) error
CreateSnapshotInfo stores the snapshot of the given document.
func (*Client) DeactivateClient ¶
DeactivateClient deactivates the client of the given ID.
func (*Client) FindChangeInfosBetweenServerSeqs ¶
func (c *Client) FindChangeInfosBetweenServerSeqs( ctx context.Context, docID db.ID, from uint64, to uint64, ) ([]*change.Change, error)
FindChangeInfosBetweenServerSeqs returns the changes between two server sequences.
func (*Client) FindClientInfoByID ¶
FindClientInfoByID finds the client of the given ID.
func (*Client) FindDocInfoByKey ¶
func (c *Client) FindDocInfoByKey( ctx context.Context, clientInfo *db.ClientInfo, bsonDocKey string, createDocIfNotExist bool, ) (*db.DocInfo, error)
FindDocInfoByKey finds the document of the given key. If the createDocIfNotExist condition is true, create the document if it does not exist.
func (*Client) FindLastSnapshotInfo ¶
func (c *Client) FindLastSnapshotInfo( ctx context.Context, docID db.ID, ) (*db.SnapshotInfo, error)
FindLastSnapshotInfo finds the last snapshot of the given document.
func (*Client) StoreChangeInfos ¶ added in v0.1.3
func (c *Client) StoreChangeInfos( ctx context.Context, docInfo *db.DocInfo, initialServerSeq uint64, changes []*change.Change, ) error
StoreChangeInfos stores the given changes and doc info.
func (*Client) UpdateAndFindMinSyncedTicket ¶
func (c *Client) UpdateAndFindMinSyncedTicket( ctx context.Context, clientInfo *db.ClientInfo, docID db.ID, serverSeq uint64, ) (*time.Ticket, error)
UpdateAndFindMinSyncedTicket updates the given serverSeq of the given client and returns the min synced ticket.
func (*Client) UpdateClientInfoAfterPushPull ¶
func (c *Client) UpdateClientInfoAfterPushPull( ctx context.Context, clientInfo *db.ClientInfo, docInfo *db.DocInfo, ) error
UpdateClientInfoAfterPushPull updates the client from the given clientInfo after handling PushPull.
type Config ¶
type Config struct { ConnectionTimeoutSec gotime.Duration `json:"ConnectionTimeoutSec"` ConnectionURI string `json:"ConnectionURI"` YorkieDatabase string `json:"YorkieDatabase"` PingTimeoutSec gotime.Duration `json:"PingTimeoutSec"` }
Config is the configuration for creating a Client instance.