Documentation ¶
Index ¶
- type Client
- func (c *Client) ActivateClient(ctx context.Context, projectID types.ID, key string) (*database.ClientInfo, error)
- func (c *Client) Close() error
- func (c *Client) CreateChangeInfos(ctx context.Context, projectID types.ID, docInfo *database.DocInfo, ...) error
- func (c *Client) CreateProjectInfo(ctx context.Context, name string) (*database.ProjectInfo, error)
- func (c *Client) CreateSnapshotInfo(ctx context.Context, docID types.ID, doc *document.InternalDocument) error
- func (c *Client) DeactivateClient(ctx context.Context, projectID, clientID types.ID) (*database.ClientInfo, error)
- func (c *Client) EnsureDefaultProjectInfo(ctx context.Context) (*database.ProjectInfo, error)
- func (c *Client) FindChangeInfosBetweenServerSeqs(ctx context.Context, docID types.ID, from uint64, to uint64) ([]*database.ChangeInfo, error)
- func (c *Client) FindChangesBetweenServerSeqs(ctx context.Context, docID types.ID, from uint64, to uint64) ([]*change.Change, error)
- func (c *Client) FindClientInfoByID(ctx context.Context, projectID, clientID types.ID) (*database.ClientInfo, error)
- func (c *Client) FindClosestSnapshotInfo(ctx context.Context, docID types.ID, serverSeq uint64) (*database.SnapshotInfo, error)
- func (c *Client) FindDeactivateCandidates(ctx context.Context, deactivateThreshold gotime.Duration, candidatesLimit int) ([]*database.ClientInfo, error)
- func (c *Client) FindDocInfoByID(ctx context.Context, id types.ID) (*database.DocInfo, error)
- func (c *Client) FindDocInfoByKey(ctx context.Context, projectID types.ID, docKey key.Key) (*database.DocInfo, error)
- func (c *Client) FindDocInfoByKeyAndOwner(ctx context.Context, projectID types.ID, clientID types.ID, docKey key.Key, ...) (*database.DocInfo, error)
- func (c *Client) FindDocInfosByPaging(ctx context.Context, projectID types.ID, paging types.Paging[types.ID]) ([]*database.DocInfo, error)
- func (c *Client) FindProjectInfoByID(ctx context.Context, id types.ID) (*database.ProjectInfo, error)
- func (c *Client) FindProjectInfoByName(ctx context.Context, name string) (*database.ProjectInfo, error)
- func (c *Client) FindProjectInfoByPublicKey(ctx context.Context, publicKey string) (*database.ProjectInfo, error)
- func (c *Client) ListProjectInfos(ctx context.Context) ([]*database.ProjectInfo, error)
- func (c *Client) UpdateAndFindMinSyncedTicket(ctx context.Context, clientInfo *database.ClientInfo, docID types.ID, ...) (*time.Ticket, error)
- func (c *Client) UpdateClientInfoAfterPushPull(ctx context.Context, clientInfo *database.ClientInfo, ...) error
- func (c *Client) UpdateProjectInfo(ctx context.Context, id types.ID, fields *types.UpdatableProjectFields) (*database.ProjectInfo, error)
- func (c *Client) UpdateSyncedSeq(ctx context.Context, clientInfo *database.ClientInfo, docID types.ID, ...) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 ¶
func (c *Client) ActivateClient(ctx context.Context, projectID types.ID, key string) (*database.ClientInfo, error)
ActivateClient activates the client of the given key.
func (*Client) CreateChangeInfos ¶
func (c *Client) CreateChangeInfos( ctx context.Context, projectID types.ID, docInfo *database.DocInfo, initialServerSeq uint64, changes []*change.Change, ) error
CreateChangeInfos stores the given changes and doc info.
func (*Client) CreateProjectInfo ¶
CreateProjectInfo creates a new project.
func (*Client) CreateSnapshotInfo ¶
func (c *Client) CreateSnapshotInfo( ctx context.Context, docID types.ID, doc *document.InternalDocument, ) error
CreateSnapshotInfo stores the snapshot of the given document.
func (*Client) DeactivateClient ¶
func (c *Client) DeactivateClient(ctx context.Context, projectID, clientID types.ID) (*database.ClientInfo, error)
DeactivateClient deactivates the client of the given ID.
func (*Client) EnsureDefaultProjectInfo ¶
EnsureDefaultProjectInfo creates the default project info if it does not exist.
func (*Client) FindChangeInfosBetweenServerSeqs ¶
func (c *Client) FindChangeInfosBetweenServerSeqs( ctx context.Context, docID types.ID, from uint64, to uint64, ) ([]*database.ChangeInfo, error)
FindChangeInfosBetweenServerSeqs returns the changeInfos between two server sequences.
func (*Client) FindChangesBetweenServerSeqs ¶
func (c *Client) FindChangesBetweenServerSeqs( ctx context.Context, docID types.ID, from uint64, to uint64, ) ([]*change.Change, error)
FindChangesBetweenServerSeqs returns the changes between two server sequences.
func (*Client) FindClientInfoByID ¶
func (c *Client) FindClientInfoByID(ctx context.Context, projectID, clientID types.ID) (*database.ClientInfo, error)
FindClientInfoByID finds the client of the given ID.
func (*Client) FindClosestSnapshotInfo ¶
func (c *Client) FindClosestSnapshotInfo( ctx context.Context, docID types.ID, serverSeq uint64, ) (*database.SnapshotInfo, error)
FindClosestSnapshotInfo finds the last snapshot of the given document.
func (*Client) FindDeactivateCandidates ¶
func (c *Client) FindDeactivateCandidates( ctx context.Context, deactivateThreshold gotime.Duration, candidatesLimit int, ) ([]*database.ClientInfo, error)
FindDeactivateCandidates finds the clients that need housekeeping.
func (*Client) FindDocInfoByID ¶
FindDocInfoByID finds a docInfo of the given ID.
func (*Client) FindDocInfoByKey ¶
func (c *Client) FindDocInfoByKey( ctx context.Context, projectID types.ID, docKey key.Key, ) (*database.DocInfo, error)
FindDocInfoByKey finds the document of the given key.
func (*Client) FindDocInfoByKeyAndOwner ¶ added in v0.2.9
func (c *Client) FindDocInfoByKeyAndOwner( ctx context.Context, projectID types.ID, clientID types.ID, docKey key.Key, createDocIfNotExist bool, ) (*database.DocInfo, error)
FindDocInfoByKeyAndOwner finds the document of the given key. If the createDocIfNotExist condition is true, create the document if it does not exist.
func (*Client) FindDocInfosByPaging ¶
func (c *Client) FindDocInfosByPaging( ctx context.Context, projectID types.ID, paging types.Paging[types.ID], ) ([]*database.DocInfo, error)
FindDocInfosByPaging returns the docInfos of the given paging.
func (*Client) FindProjectInfoByID ¶ added in v0.2.8
func (c *Client) FindProjectInfoByID(ctx context.Context, id types.ID) (*database.ProjectInfo, error)
FindProjectInfoByID returns a project by the given id.
func (*Client) FindProjectInfoByName ¶ added in v0.2.6
func (c *Client) FindProjectInfoByName(ctx context.Context, name string) (*database.ProjectInfo, error)
FindProjectInfoByName returns a project by name.
func (*Client) FindProjectInfoByPublicKey ¶
func (c *Client) FindProjectInfoByPublicKey(ctx context.Context, publicKey string) (*database.ProjectInfo, error)
FindProjectInfoByPublicKey returns a project by public key.
func (*Client) ListProjectInfos ¶
ListProjectInfos returns all project infos.
func (*Client) UpdateAndFindMinSyncedTicket ¶
func (c *Client) UpdateAndFindMinSyncedTicket( ctx context.Context, clientInfo *database.ClientInfo, docID types.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 *database.ClientInfo, docInfo *database.DocInfo, ) error
UpdateClientInfoAfterPushPull updates the client from the given clientInfo after handling PushPull.
func (*Client) UpdateProjectInfo ¶
func (c *Client) UpdateProjectInfo( ctx context.Context, id types.ID, fields *types.UpdatableProjectFields, ) (*database.ProjectInfo, error)
UpdateProjectInfo updates the project info.
type Config ¶
type Config struct { ConnectionTimeout string `yaml:"ConnectionTimeout"` ConnectionURI string `yaml:"ConnectionURI"` YorkieDatabase string `yaml:"YorkieDatabase"` PingTimeout string `yaml:"PingTimeout"` }
Config is the configuration for creating a Client instance.
func (*Config) ParseConnectionTimeout ¶
ParseConnectionTimeout returns connection timeout duration.
func (*Config) ParsePingTimeout ¶
ParsePingTimeout returns ping timeout duration.