memstore

package
v1.0.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActivityIterator

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

ActivityIterator is used to iterator over activities.

func NewActivityIterator

func NewActivityIterator(results []*vocab.ActivityType, totalItems int) *ActivityIterator

NewActivityIterator creates a new ActivityIterator.

func (ActivityIterator) Close

func (it ActivityIterator) Close() error

func (*ActivityIterator) Next

func (it *ActivityIterator) Next() (*vocab.ActivityType, error)

Next returns the next activity or an ErrNotFound error if there are no more items.

func (ActivityIterator) TotalItems

func (it ActivityIterator) TotalItems() (int, error)

type ReferenceIterator

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

ReferenceIterator is used to iterator over references.

func NewReferenceIterator

func NewReferenceIterator(results []*url.URL, totalItems int) *ReferenceIterator

NewReferenceIterator creates a new ReferenceIterator.

func (ReferenceIterator) Close

func (it ReferenceIterator) Close() error

func (*ReferenceIterator) Next

func (it *ReferenceIterator) Next() (*url.URL, error)

Next returns the next reference or an ErrNotFound error if there are no more items.

func (ReferenceIterator) TotalItems

func (it ReferenceIterator) TotalItems() (int, error)

type Store

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

Store implements an in-memory ActivityPub store.

func New

func New(serviceName string) *Store

New returns a new in-memory ActivityPub store.

func (*Store) AddActivity

func (s *Store) AddActivity(activity *vocab.ActivityType) error

AddActivity adds the given activity to the activity store.

func (*Store) AddReference

func (s *Store) AddReference(referenceType spi.ReferenceType, objectIRI *url.URL, referenceIRI *url.URL,
	refMetaDataOpts ...spi.RefMetadataOpt) error

AddReference adds the reference of the given type to the given object.

func (*Store) DeleteReference

func (s *Store) DeleteReference(referenceType spi.ReferenceType, objectIRI, referenceIRI *url.URL) error

DeleteReference deletes the reference of the given type from the given actor.

func (*Store) GetActivity

func (s *Store) GetActivity(activityID *url.URL) (*vocab.ActivityType, error)

GetActivity returns the activity for the given ID from the activity store or ErrNotFound error if it wasn't found.

func (*Store) GetActor

func (s *Store) GetActor(iri *url.URL) (*vocab.ActorType, error)

GetActor returns the actor for the given IRI. Returns an ErrNoFound error if the actor is not in the store.

func (*Store) PutActor

func (s *Store) PutActor(actor *vocab.ActorType) error

PutActor stores the given actor.

func (*Store) QueryActivities

func (s *Store) QueryActivities(query *spi.Criteria, opts ...spi.QueryOpt) (spi.ActivityIterator, error)

QueryActivities queries the given activity store using the provided criteria and returns a results iterator.

func (*Store) QueryReferences

func (s *Store) QueryReferences(refType spi.ReferenceType,
	query *spi.Criteria, opts ...spi.QueryOpt) (spi.ReferenceIterator, error)

QueryReferences returns the list of references of the given type according to the given query.

Jump to

Keyboard shortcuts

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