Documentation ¶
Index ¶
- Variables
- type Broadcaster
- type Metrics
- type NewEventFunc
- type Replica
- func (r *Replica) BroadcastAppend(ctx context.Context, env *messagev1.Envelope) (*types.Event, error)
- func (r *Replica) Close()
- func (r *Replica) GetEvents(ctx context.Context, cids ...mh.Multihash) ([]*types.Event, error)
- func (r *Replica) Query(ctx context.Context, req *messagev1.QueryRequest) (*messagev1.QueryResponse, error)
- type Store
- type Syncer
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrStoreInvalidCursor = errors.New("cursor event not found")
The cursor event couldn't be find in the event range resulting from the parameters of the query. The store may have changed since the query that yielded that cursor.
Functions ¶
This section is empty.
Types ¶
type Broadcaster ¶
type Broadcaster interface { // Broadcast sends an Event out to the network Broadcast(context.Context, *types.Event) error // Next obtains the next event received from the network. Next(ctx context.Context) (*types.Event, error) // Close gracefully closes the broadcaster. Close() error }
Broadcaster manages broadcasts for a replica.
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶
func NewMetrics() *Metrics
type NewEventFunc ¶
type Replica ¶
type Replica struct {
// contains filtered or unexported fields
}
Replica manages the DAG of a dataset replica.
func NewReplica ¶
func NewReplica(ctx context.Context, metrics *Metrics, store Store, bc Broadcaster, syncer Syncer, onNewEvent NewEventFunc) (*Replica, error)
func (*Replica) BroadcastAppend ¶
func (*Replica) Query ¶
func (r *Replica) Query(ctx context.Context, req *messagev1.QueryRequest) (*messagev1.QueryResponse, error)
type Store ¶
type Store interface { // AppendEvent creates and stores a new Event, // making the current heads its links and // replacing the heads with the new Event. // Returns the new Event. AppendEvent(ctx context.Context, env *messagev1.Envelope) (*types.Event, error) // InsertEvent stores the Event if it isn't know yet, // Returns whether it was actually added. InsertEvent(ctx context.Context, ev *types.Event) (bool, error) // InsertHead stores the Event if it isn't know yet, // and add it to the heads // Returns whether it was actually added. InsertHead(ctx context.Context, ev *types.Event) (bool, error) // RemoveHead checks if we already have the event, // and also removes it from heads if it's there. // Returns whether we already have the event or not. RemoveHead(ctx context.Context, cid multihash.Multihash) (bool, error) // GetEvents returns the set of events matching the given set of CIDs. GetEvents(ctx context.Context, cids ...multihash.Multihash) ([]*types.Event, error) // FindMissingLinks scans the whole topic for links // pointing to Events that are not present in the topic. // Returns the list of all missing links. FindMissingLinks(ctx context.Context) ([]multihash.Multihash, error) // Query returns a set of envelopes matching the query request criteria. Query(ctx context.Context, req *messagev1.QueryRequest) (*messagev1.QueryResponse, error) }
Store represents the storage capacity for a specific CRDT.
type Syncer ¶
type Syncer interface { // Fetch retrieves a set of Events from the network DHT. // It is a single attempt that can fail completely or return only some // of the requested events. If there is no error, the resulting slice is always // the same size as the CID slice, but there can be some nils instead of Events in it. Fetch(context.Context, []multihash.Multihash) ([]*types.Event, error) // Close gracefully closes the syncer. Close() error }
Syncer provides syncing capability to a specific replica.
Click to show internal directories.
Click to hide internal directories.