Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = fmt.Errorf("not found in ActivityPub store")
ErrNotFound is returned from various store functions when a requested object is not found in the store.
Functions ¶
This section is empty.
Types ¶
type ActivityIterator ¶
type ActivityIterator interface { // TotalItems returns the total number of items as a result of the query. TotalItems() (int, error) // Next returns the next activity or an ErrNotFound error if there are no more items. Next() (*vocab.ActivityType, error) // Close closes the iterator. Close() error }
ActivityIterator defines the query results iterator for activity queries.
type Criteria ¶
type Criteria struct { Types []vocab.Type ReferenceType ReferenceType ObjectIRI *url.URL ReferenceIRI *url.URL ActivityIRIs []*url.URL }
Criteria holds the search criteria for a query.
func NewCriteria ¶
func NewCriteria(opts ...CriteriaOpt) *Criteria
NewCriteria returns new Criteria which may be used to perform a query.
func (*Criteria) MarshalJSON ¶
MarshalJSON marshals the criteria into a logger-friendly format.
type CriteriaOpt ¶
type CriteriaOpt func(q *Criteria)
CriteriaOpt sets a Criteria option.
func WithActivityIRIs ¶
func WithActivityIRIs(iris ...*url.URL) CriteriaOpt
WithActivityIRIs sets the activity IRIs on the criteria.
func WithObjectIRI ¶
func WithObjectIRI(iri *url.URL) CriteriaOpt
WithObjectIRI sets the object IRI on the criteria.
func WithReferenceIRI ¶
func WithReferenceIRI(iri *url.URL) CriteriaOpt
WithReferenceIRI sets the reference IRI on the criteria.
func WithReferenceType ¶
func WithReferenceType(refType ReferenceType) CriteriaOpt
WithReferenceType sets the reference type on the criteria.
func WithType ¶
func WithType(t ...vocab.Type) CriteriaOpt
WithType sets the object Type on the criteria.
type QueryOpt ¶
type QueryOpt func(options *QueryOptions)
QueryOpt sets a query option.
func WithSortOrder ¶
WithSortOrder sets the sort order. (Default is ascending.)
type QueryOptions ¶
QueryOptions holds options for a query.
type RefMetadata ¶
RefMetadata holds additional metadata to be stored in a reference entry.
type RefMetadataOpt ¶
type RefMetadataOpt func(refMetaData *RefMetadata)
RefMetadataOpt sets additional metadata to be stored in a reference entry.
func WithActivityType ¶
func WithActivityType(activityType vocab.Type) RefMetadataOpt
WithActivityType is used to indicate that the reference points to an activity with the given type.
type ReferenceIterator ¶
type ReferenceIterator interface { // TotalItems returns the total number of items as a result of the query. TotalItems() (int, error) // Next returns the next reference or an ErrNotFound error if there are no more items. Next() (*url.URL, error) // Close closes the iterator. Close() error }
ReferenceIterator defines the query results iterator for reference queries.
type ReferenceType ¶
type ReferenceType string
ReferenceType defines the type of reference, e.g. follower, witness, etc.
const ( // Inbox indicates that the reference is an activity in a service's inbox. Inbox ReferenceType = "INBOX" // Outbox indicates that the reference is an activity in a service's outbox. Outbox ReferenceType = "OUTBOX" // PublicOutbox indicates that the reference is an activity posted to the service's outbox and was addressed // to 'https://www.w3.org/ns/activitystreams#Public' and therefore may be accessed by anyone without requiring // authentication. PublicOutbox ReferenceType = "PUBLIC_OUTBOX" // Follower indicates that the reference is an actor that's following the local service. Follower ReferenceType = "FOLLOWER" // Following indicates that the reference is an actor that the local service is following. Following ReferenceType = "FOLLOWING" // Witness indicates that the reference is an actor to which the local service sends // anchor credentials to witness. Witness ReferenceType = "WITNESS" // Witnessing indicates that the reference is a service from which the local service // receives anchor credentials to witness. Witnessing ReferenceType = "WITNESSING" // Like indicates that the reference is a 'Like' activity. Like ReferenceType = "LIKE" // Liked indicates that the reference is an object that the local service witnessed // and liked (endorsed). Liked ReferenceType = "LIKED" Share ReferenceType = "SHARE" // AnchorLinkset indicates that the reference is an anchor Linkset. AnchorLinkset ReferenceType = "ANCHOR_LINKSET" )
type Store ¶
type Store interface { // AddActivity adds the given activity to the activity store. AddActivity(activity *vocab.ActivityType) error // GetActivity returns the activity for the given ID from the given activity store // or an ErrNotFound error if it wasn't found. GetActivity(activityID *url.URL) (*vocab.ActivityType, error) // QueryActivities queries the given activity store using the provided criteria // and returns a results iterator. QueryActivities(query *Criteria, opts ...QueryOpt) (ActivityIterator, error) // AddReference adds the reference of the given type to the given object. AddReference(refType ReferenceType, objectIRI *url.URL, referenceIRI *url.URL, metaDataOpts ...RefMetadataOpt) error // DeleteReference deletes the reference of the given type from the given object. DeleteReference(refType ReferenceType, objectIRI *url.URL, referenceIRI *url.URL) error // QueryReferences returns the list of references of the given type according to the given query. QueryReferences(refType ReferenceType, query *Criteria, opts ...QueryOpt) (ReferenceIterator, error) }
Store defines the functions of an ActivityPub store.