net

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2020 License: MIT Imports: 36 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DialTimeout is the max time duration to wait when dialing a peer.
	DialTimeout = time.Second * 10
	PushTimeout = time.Second * 10
	PullTimeout = time.Second * 10
)
View Source
var (

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

	// PullStartAfter is the pause before thread pulling process starts.
	PullStartAfter = time.Second

	// InitialPullInterval is the interval for the first iteration of log pulls.
	InitialPullInterval = time.Second

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

	// EventBusCapacity is the buffer size of local event bus listeners.
	EventBusCapacity = 1
)

Functions

func NewNetwork

func NewNetwork(
	ctx context.Context,
	h host.Host,
	bstore bs.Blockstore,
	ds format.DAGService,
	ls lstore.Logstore,
	conf Config,
	serverOptions []grpc.ServerOption,
	dialOptions []grpc.DialOption,
) (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
	PubSub bool
}

Config is used to specify thread instance options.

type Handler

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

Handler receives all pushed thread records.

type PubSub

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

PubSub manages thread pubsub topics.

func NewPubSub

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

NewPubSub returns a new thread topic manager.

func (*PubSub) Add

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

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

Publish a record request to a thread.

func (*PubSub) Remove

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
}

Record implements core.Record. The most basic component of a Log.

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