Documentation ¶
Overview ¶
Package memory provides the memory implementation of the sync package.
Index ¶
- type Coordinator
- func (c *Coordinator) Close() error
- func (c *Coordinator) Members() map[string]*sync.ServerInfo
- func (c *Coordinator) NewLocker(ctx context.Context, key sync.Key) (sync.Locker, error)
- func (c *Coordinator) Publish(ctx context.Context, publisherID *time.ActorID, event sync.DocEvent)
- func (c *Coordinator) PublishToLocal(ctx context.Context, publisherID *time.ActorID, event sync.DocEvent)
- func (c *Coordinator) Subscribe(ctx context.Context, subscriber types.Client, keys []key.Key) (*sync.Subscription, map[string][]types.Client, error)
- func (c *Coordinator) Unsubscribe(ctx context.Context, keys []key.Key, sub *sync.Subscription) error
- func (c *Coordinator) UpdatePresence(_ context.Context, publisher *types.Client, keys []key.Key) (*sync.DocEvent, error)
- type PubSub
- func (m *PubSub) BuildPeersMap(keys []key.Key) map[string][]types.Client
- func (m *PubSub) Publish(ctx context.Context, publisherID *time.ActorID, event sync.DocEvent)
- func (m *PubSub) Subscribe(ctx context.Context, subscriber types.Client, keys []key.Key) (*sync.Subscription, error)
- func (m *PubSub) Unsubscribe(ctx context.Context, docKeys []key.Key, sub *sync.Subscription)
- func (m *PubSub) UpdatePresence(publisher *types.Client, keys []key.Key) *sync.Subscription
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Coordinator ¶
type Coordinator struct {
// contains filtered or unexported fields
}
Coordinator is a memory-based implementation of sync.Coordinator.
func NewCoordinator ¶
func NewCoordinator(serverInfo *sync.ServerInfo) *Coordinator
NewCoordinator creates an instance of Coordinator.
func (*Coordinator) Close ¶
func (c *Coordinator) Close() error
Close closes all resources of this Coordinator.
func (*Coordinator) Members ¶
func (c *Coordinator) Members() map[string]*sync.ServerInfo
Members returns the members of this cluster.
func (*Coordinator) Publish ¶
func (c *Coordinator) Publish( ctx context.Context, publisherID *time.ActorID, event sync.DocEvent, )
Publish publishes the given event.
func (*Coordinator) PublishToLocal ¶
func (c *Coordinator) PublishToLocal( ctx context.Context, publisherID *time.ActorID, event sync.DocEvent, )
PublishToLocal publishes the given event.
func (*Coordinator) Subscribe ¶
func (c *Coordinator) Subscribe( ctx context.Context, subscriber types.Client, keys []key.Key, ) (*sync.Subscription, map[string][]types.Client, error)
Subscribe subscribes to the given documents.
func (*Coordinator) Unsubscribe ¶
func (c *Coordinator) Unsubscribe( ctx context.Context, keys []key.Key, sub *sync.Subscription, ) error
Unsubscribe unsubscribes the given documents.
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
PubSub is the memory implementation of PubSub, used for single server.
func (*PubSub) BuildPeersMap ¶
BuildPeersMap builds the peers map of the given keys.
func (*PubSub) Subscribe ¶
func (m *PubSub) Subscribe( ctx context.Context, subscriber types.Client, keys []key.Key, ) (*sync.Subscription, error)
Subscribe subscribes to the given document keys.
func (*PubSub) Unsubscribe ¶
Unsubscribe unsubscribes the given docKeys.
func (*PubSub) UpdatePresence ¶
UpdatePresence updates the presence of the given client.