objectmanager

package
v0.18.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2021 License: MIT Imports: 17 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ErrDone    = errors.Error("done")
	ErrTimeout = errors.Error("request timed out")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type LookupOption

type LookupOption func(*LookupOptions)

LookupOptions

func FilterByCID added in v0.17.0

func FilterByCID(hs ...object.CID) LookupOption

func FilterByObjectType

func FilterByObjectType(typePatterns ...string) LookupOption

func FilterByOwner

func FilterByOwner(hs ...crypto.PublicKey) LookupOption

func FilterByStreamCID added in v0.17.0

func FilterByStreamCID(hs ...object.CID) LookupOption

type LookupOptions

type LookupOptions struct {
	// Lookups are used to perform db queries for these filters
	// TODO find a better name for this
	Lookups struct {
		ObjectCIDs   []object.CID
		StreamCIDs   []object.CID
		ContentTypes []string
		Owners       []crypto.PublicKey
	}
	// filters are the lookups equivalents for matching objects for pubsub
	Filters []ObjectFilter
}

LookupOptions

type ObjectFilter

type ObjectFilter func(*object.Object) bool

type ObjectManager

type ObjectManager interface {
	Put(
		ctx context.Context,
		o *object.Object,
	) (*object.Object, error)
	Request(
		ctx context.Context,
		cid object.CID,
		peer *peer.ConnectionInfo,
	) (*object.Object, error)
	RequestStream(
		ctx context.Context,
		rootCID object.CID,
		recipients ...*peer.ConnectionInfo,
	) (object.ReadCloser, error)
	AddStreamSubscription(
		ctx context.Context,
		rootCID object.CID,
	) error
	Subscribe(
		lookupOptions ...LookupOption,
	) ObjectSubscription
}

type ObjectPubSub

type ObjectPubSub interface {
	Publish(*object.Object)
	Subscribe(...ObjectFilter) ObjectSubscription
}

ObjectPubSub -

func NewObjectPubSub

func NewObjectPubSub() ObjectPubSub

NewObject constructs and returns a new Object

type ObjectSubscription

type ObjectSubscription interface {
	object.ReadCloser
	Channel() <-chan *object.Object
}

ObjectSubscription is returned for every subscription

type Option

type Option func(*manager)

type SubscriptionsMap

type SubscriptionsMap struct {
	// contains filtered or unexported fields
}

SubscriptionsMap -

func NewSubscriptionsMap

func NewSubscriptionsMap() *SubscriptionsMap

NewSubscriptionsMap constructs a new SyncMap

func (*SubscriptionsMap) Delete

func (m *SubscriptionsMap) Delete(k object.CID)

Delete -

func (*SubscriptionsMap) Get

Get -

func (*SubscriptionsMap) GetOrPut

GetOrPut -

func (*SubscriptionsMap) ListKeys

func (m *SubscriptionsMap) ListKeys() []object.CID

ListKeys -

func (*SubscriptionsMap) ListValues

func (m *SubscriptionsMap) ListValues() []*stream.Subscription

ListValues -

func (*SubscriptionsMap) Put

Put -

func (*SubscriptionsMap) Range

func (m *SubscriptionsMap) Range(i func(k object.CID, v *stream.Subscription) bool)

Range -

Jump to

Keyboard shortcuts

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