-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathstorage.go
More file actions
40 lines (34 loc) · 1.27 KB
/
storage.go
File metadata and controls
40 lines (34 loc) · 1.27 KB
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
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 vocabulary 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 completely deletes from storage the vocabulary Object, this is usually
// a side effect of an Undo activity.
Delete(vocab.Item) error
}
// CollectionStore allows operations on ActivityStreams collections
type CollectionStore interface {
// Create creates the "col" collection.
// Deprecated: as we only use Create in FedBOX.
Create(vocab.CollectionInterface) (vocab.CollectionInterface, error)
// AddTo adds "it" element to the "col" collection.
AddTo(vocab.IRI, ...vocab.Item) error
// RemoveFrom removes "it" item from "col" collection
RemoveFrom(vocab.IRI, ...vocab.Item) error
}