Documentation ¶
Index ¶
- Constants
- Variables
- func HandleEnvelopeSubscription(sub EnvelopeSubscription, handler func(*Envelope) error)
- type AddressesMap
- func (m *AddressesMap) Delete(k string)
- func (m *AddressesMap) Get(k string) (*addressState, bool)
- func (m *AddressesMap) GetOrPut(k string, v *addressState) (*addressState, bool)
- func (m *AddressesMap) Put(k string, v *addressState)
- func (m *AddressesMap) Range(i func(k string, v *addressState) bool)
- type ConnectionManager
- type DataForward
- type Envelope
- type EnvelopeFilter
- type EnvelopePubSub
- type EnvelopeSubscription
- type Exchange
- type MockEnvelopeSubscription
- type MockExchange
- func (_m *MockExchange) Request(ctx context.Context, _a1 object.Hash, recipient peer.LookupOption, ...) error
- func (_m *MockExchange) Send(ctx context.Context, _a1 object.Object, recipient peer.LookupOption, ...) error
- func (_m *MockExchange) SendToAddress(ctx context.Context, _a1 object.Object, address string, options ...Option) error
- func (_m *MockExchange) Subscribe(filters ...EnvelopeFilter) EnvelopeSubscription
- type ObjectRequest
- type Option
- type Options
- type OutboxesMap
- func (m *OutboxesMap) Delete(k crypto.PublicKey)
- func (m *OutboxesMap) Get(k crypto.PublicKey) (*outbox, bool)
- func (m *OutboxesMap) GetOrPut(k crypto.PublicKey, v *outbox) (*outbox, bool)
- func (m *OutboxesMap) Put(k crypto.PublicKey, v *outbox)
- func (m *OutboxesMap) Range(i func(k crypto.PublicKey, v *outbox) bool)
Constants ¶
const ( // ErrInvalidRequest when received an invalid request object ErrInvalidRequest = errors.Error("invalid request") // ErrSendingTimedOut when sending times out ErrSendingTimedOut = errors.Error("sending timed out") )
Variables ¶
var ( // ErrNotFound is returned by Get() when the object was not found ErrNotFound = errors.New("not found") // ErrCannotSendToSelf is returned when trying to Send() to our own peer ErrCannotSendToSelf = errors.New("cannot send objects to ourself") )
Functions ¶
func HandleEnvelopeSubscription ¶ added in v0.5.0
func HandleEnvelopeSubscription( sub EnvelopeSubscription, handler func(*Envelope) error, )
Types ¶
type AddressesMap ¶ added in v0.5.0
type AddressesMap struct {
// contains filtered or unexported fields
}
AddressesMap -
func NewAddressesMap ¶ added in v0.5.0
func NewAddressesMap() *AddressesMap
NewAddressesMap constructs a new SyncMap
func (*AddressesMap) Get ¶ added in v0.5.0
func (m *AddressesMap) Get(k string) (*addressState, bool)
Get -
func (*AddressesMap) GetOrPut ¶ added in v0.5.0
func (m *AddressesMap) GetOrPut(k string, v *addressState) (*addressState, bool)
GetOrPut -
func (*AddressesMap) Put ¶ added in v0.5.0
func (m *AddressesMap) Put(k string, v *addressState)
Put -
func (*AddressesMap) Range ¶ added in v0.5.0
func (m *AddressesMap) Range(i func(k string, v *addressState) bool)
Range -
type ConnectionManager ¶
type ConnectionManager struct {
// contains filtered or unexported fields
}
func (*ConnectionManager) Add ¶
func (cm *ConnectionManager) Add(address string, conn *net.Connection)
func (*ConnectionManager) Close ¶
func (cm *ConnectionManager) Close(fingerprint string)
func (*ConnectionManager) Get ¶
func (cm *ConnectionManager) Get(remoteID string) (*net.Connection, error)
type DataForward ¶ added in v0.5.0
type DataForward struct { Stream object.Hash Parents []object.Hash Owners []crypto.PublicKey Policy object.Policy Signatures []object.Signature Recipient crypto.PublicKey Data []byte // contains filtered or unexported fields }
func (*DataForward) FromObject ¶ added in v0.5.0
func (e *DataForward) FromObject(o object.Object) error
func (DataForward) GetSchema ¶ added in v0.5.0
func (e DataForward) GetSchema() *object.SchemaObject
func (DataForward) GetType ¶ added in v0.5.0
func (e DataForward) GetType() string
func (DataForward) ToObject ¶ added in v0.5.0
func (e DataForward) ToObject() object.Object
type EnvelopeFilter ¶ added in v0.5.0
func FilterByObjectType ¶ added in v0.5.0
func FilterByObjectType(typePatterns ...string) EnvelopeFilter
func FilterBySender ¶ added in v0.5.0
func FilterBySender(keys ...crypto.PublicKey) EnvelopeFilter
type EnvelopePubSub ¶ added in v0.5.0
type EnvelopePubSub interface { Publish(*Envelope) Subscribe(...EnvelopeFilter) EnvelopeSubscription }
EnvelopePubSub -
func NewEnvelopePubSub ¶ added in v0.5.0
func NewEnvelopePubSub() EnvelopePubSub
NewEnvelope constructs and returns a new EnvelopePubSub
type EnvelopeSubscription ¶ added in v0.5.0
EnvelopeSubscription is returned for every subscription
type Exchange ¶
type Exchange interface { Request( ctx context.Context, object object.Hash, recipient peer.LookupOption, options ...Option, ) error Subscribe( filters ...EnvelopeFilter, ) EnvelopeSubscription Send( ctx context.Context, object object.Object, recipient peer.LookupOption, options ...Option, ) error SendToAddress( ctx context.Context, object object.Object, address string, options ...Option, ) error }
Exchange interface for mocking exchange
type MockEnvelopeSubscription ¶ added in v0.5.0
type MockEnvelopeSubscription struct {
// contains filtered or unexported fields
}
func (*MockEnvelopeSubscription) AddNext ¶ added in v0.5.0
func (s *MockEnvelopeSubscription) AddNext(env *Envelope, err error)
func (*MockEnvelopeSubscription) Cancel ¶ added in v0.5.0
func (s *MockEnvelopeSubscription) Cancel()
func (*MockEnvelopeSubscription) Next ¶ added in v0.5.0
func (s *MockEnvelopeSubscription) Next() (*Envelope, error)
type MockExchange ¶
MockExchange is an autogenerated mock type for the Exchange type
func (*MockExchange) Request ¶
func (_m *MockExchange) Request(ctx context.Context, _a1 object.Hash, recipient peer.LookupOption, options ...Option) error
Request provides a mock function with given fields: ctx, _a1, recipient, options
func (*MockExchange) Send ¶
func (_m *MockExchange) Send(ctx context.Context, _a1 object.Object, recipient peer.LookupOption, options ...Option) error
Send provides a mock function with given fields: ctx, _a1, recipient, options
func (*MockExchange) SendToAddress ¶ added in v0.5.0
func (_m *MockExchange) SendToAddress(ctx context.Context, _a1 object.Object, address string, options ...Option) error
SendToAddress provides a mock function with given fields: ctx, _a1, address, options
func (*MockExchange) Subscribe ¶ added in v0.5.0
func (_m *MockExchange) Subscribe(filters ...EnvelopeFilter) EnvelopeSubscription
Subscribe provides a mock function with given fields: filters
type ObjectRequest ¶
type ObjectRequest struct { Stream object.Hash Parents []object.Hash Owners []crypto.PublicKey Policy object.Policy Signatures []object.Signature ObjectHash object.Hash // contains filtered or unexported fields }
func (*ObjectRequest) FromObject ¶
func (e *ObjectRequest) FromObject(o object.Object) error
func (ObjectRequest) GetSchema ¶ added in v0.5.0
func (e ObjectRequest) GetSchema() *object.SchemaObject
func (ObjectRequest) GetType ¶
func (e ObjectRequest) GetType() string
func (ObjectRequest) ToObject ¶
func (e ObjectRequest) ToObject() object.Object
type Option ¶
type Option func(*Options)
func WithAsync ¶ added in v0.5.0
func WithAsync() Option
WithAsync will not wait to actually send the object
func WithLocalDiscoveryOnly ¶
func WithLocalDiscoveryOnly() Option
WithLocalDiscoveryOnly will only use local discovery to resolve addresses.
type OutboxesMap ¶ added in v0.5.0
type OutboxesMap struct {
// contains filtered or unexported fields
}
OutboxesMap -
func NewOutboxesMap ¶ added in v0.5.0
func NewOutboxesMap() *OutboxesMap
NewOutboxesMap constructs a new SyncMap
func (*OutboxesMap) Delete ¶ added in v0.5.0
func (m *OutboxesMap) Delete(k crypto.PublicKey)
Delete -
func (*OutboxesMap) Get ¶ added in v0.5.0
func (m *OutboxesMap) Get(k crypto.PublicKey) (*outbox, bool)
Get -
func (*OutboxesMap) GetOrPut ¶ added in v0.5.0
func (m *OutboxesMap) GetOrPut(k crypto.PublicKey, v *outbox) (*outbox, bool)
GetOrPut -
func (*OutboxesMap) Put ¶ added in v0.5.0
func (m *OutboxesMap) Put(k crypto.PublicKey, v *outbox)
Put -