threadservice

package
v0.0.0-...-31fc120 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Record

type Record interface {
	// Value returns the underlying record.
	Value() thread.Record

	// ThreadID returns the record's thread ID.
	ThreadID() thread.ID

	// LogID returns the record's log ID.
	LogID() peer.ID
}

Record wraps a thread.Record within a thread and log context.

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 Record
}

Subscription receives thread record updates.

type Threadservice

type Threadservice 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() tstore.Threadstore

	// AddThread from a multiaddress.
	AddThread(ctx context.Context, addr ma.Multiaddr, opts ...options.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) (Record, error)

	// GetRecord returns the record at cid.
	GetRecord(ctx context.Context, id thread.ID, rid cid.Cid) (thread.Record, error)

	// Subscribe returns a read-only channel of records.
	Subscribe(opts ...options.SubOption) Subscription
}

Threadservice is an API for working with threads.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL