Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddOption ¶
type AddOption func(*AddOptions)
AddOption is an add thread option.
type AddOptions ¶
AddOptions defines options for adding a new thread.
type Event ¶
type Event interface {
format.Node
// HeaderID returns the cid of the event header.
HeaderID() cid.Cid
// GetHeader loads and optionally decrypts the event header.
// If no key is given, the header time and key methods will return an error.
GetHeader(context.Context, format.DAGService, crypto.DecryptionKey) (EventHeader, error)
// BodyID returns the cid of the event body.
BodyID() cid.Cid
// GetBody loads and optionally decrypts the event body.
GetBody(context.Context, format.DAGService, crypto.DecryptionKey) (format.Node, error)
}
Event is the Block format used by threads
type EventHeader ¶
type EventHeader interface {
format.Node
// Time returns the wall-clock time at which this event was created.
Time() (*time.Time, error)
// Key returns a single-use decryption key for the event body.
Key() (crypto.DecryptionKey, error)
}
EventHeader is the format of the event's header object
type Record ¶
type Record interface {
format.Node
// BlockID returns the cid of the node block.
BlockID() cid.Cid
// GetBlock loads the node block.
GetBlock(context.Context, format.DAGService) (format.Node, error)
// PrevID returns the cid of the previous node.
PrevID() cid.Cid
// Sig returns the node signature.
Sig() []byte
// Verify returns a non-nil error if the node signature is valid.
Verify(pk crypto.PubKey) error
}
Record is the most basic component of a log.
type Service ¶
type Service interface {
io.Closer
// Host provides a network identity.
Host() host.Host
// DAGService provides a DAG API to the network.
format.DAGService
// Store persists thread details.
Store() lstore.Logstore
// AddThread from a multiaddress.
AddThread(ctx context.Context, addr ma.Multiaddr, opts ...AddOption) (thread.Info, error)
// PullThread for new records.
PullThread(ctx context.Context, id thread.ID) error
// DeleteThread with id.
DeleteThread(ctx context.Context, id thread.ID) error
// AddFollower to a thread.
AddFollower(ctx context.Context, id thread.ID, pid peer.ID) error
// AddRecord with body.
AddRecord(ctx context.Context, id thread.ID, body format.Node) (ThreadRecord, error)
// GetRecord returns the record at cid.
GetRecord(ctx context.Context, id thread.ID, rid cid.Cid) (Record, error)
// Subscribe returns a read-only channel of records.
Subscribe(opts ...SubOption) Subscription
}
Service is the network interface for thread orchestration.
type SubOptions ¶
SubOptions defines options for a thread subscription.
type Subscription ¶
type Subscription interface {
// Discard closes the subscription, disabling the reception of further records.
Discard()
// Channel returns the channel that receives records.
Channel() <-chan ThreadRecord
}
Subscription receives thread record updates.
Click to show internal directories.
Click to hide internal directories.