net

package
v0.1.14-rc1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2020 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// MaxPullLimit is the maximum page size for pulling records.
	MaxPullLimit = 10000

	// InitialPullInterval is the interval between automatic log pulls.
	InitialPullInterval = time.Second

	// PullInterval is the interval between automatic log pulls.
	PullInterval = time.Second * 10
)

Functions

func NewNetwork

func NewNetwork(ctx context.Context, h host.Host, bstore bs.Blockstore, ds format.DAGService, ls lstore.Logstore, conf Config, opts ...grpc.ServerOption) (app.Net, error)

NewNetwork creates an instance of net from the given host and thread store.

func NewRecord

func NewRecord(r core.Record, id thread.ID, lid peer.ID) core.ThreadRecord

NewRecord returns a record with the given values.

Types

type Config

type Config struct {
	Debug bool
}

Config is used to specify thread instance options.

type Handler added in v0.1.13

type Handler func(context.Context, *pb.PushRecordRequest)

Handler receives all pushed thread records.

type PubSub added in v0.1.13

type PubSub struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

PubSub manages thread pubsub topics.

func NewPubSub added in v0.1.13

func NewPubSub(ctx context.Context, host peer.ID, ps *pubsub.PubSub, handler Handler) *PubSub

NewPubSub returns a new thread topic manager.

func (*PubSub) Add added in v0.1.13

func (s *PubSub) Add(id thread.ID) error

Add a new thread topic. This may be called repeatedly for the same thread.

func (*PubSub) Publish added in v0.1.13

func (s *PubSub) Publish(ctx context.Context, id thread.ID, req *pb.PushRecordRequest) error

Publish a record request to a thread.

func (*PubSub) Remove added in v0.1.13

func (s *PubSub) Remove(id thread.ID) error

Remove a thread topic. This may be called repeatedly for the same thread.

type Record

type Record struct {
	core.Record
	// contains filtered or unexported fields
}

func (*Record) LogID

func (r *Record) LogID() peer.ID

func (*Record) ThreadID

func (r *Record) ThreadID() thread.ID

func (*Record) Value

func (r *Record) Value() core.Record

Directories

Path Synopsis
api
pb

Jump to

Keyboard shortcuts

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