-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstorage.go
42 lines (36 loc) · 1.3 KB
/
storage.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package processing
import (
vocab "github.com/go-ap/activitypub"
"github.com/go-ap/filters"
)
type Store interface {
ReadStore
WriteStore
CollectionStore
}
type ReadStore interface {
// Load returns an Item or an ItemCollection from an IRI
// after filtering it through the FilterFn list of filtering functions. Eg ANY()
Load(vocab.IRI, ...filters.Check) (vocab.Item, error)
}
// WriteStore saves ActivityStreams objects.
type WriteStore interface {
// Save saves the incoming ActivityStreams Object, and returns it together with any properties
// populated by the method's side effects. (eg, Published property can point to the current time, etc.).
Save(vocab.Item) (vocab.Item, error)
// Delete deletes completely from storage the ActivityStreams Object
Delete(vocab.Item) error
}
// CollectionStore allows operations on ActivityStreams collections
type CollectionStore interface {
// Create creates the "col" collection.
Create(col vocab.CollectionInterface) (vocab.CollectionInterface, error)
// AddTo adds "it" element to the "col" collection.
AddTo(col vocab.IRI, it vocab.Item) error
// RemoveFrom removes "it" item from "col" collection
RemoveFrom(col vocab.IRI, it vocab.Item) error
}
type Metadata struct {
Pw []byte `jsonld:"pw,omitempty"`
PrivateKey []byte `jsonld:"key,omitempty"`
}