Added the interfaces we need to implement in order to support Loading/Saving of ActivityPub items
This commit is contained in:
parent
9267fbd9be
commit
d0459a1067
22
storage/filters.go
Normal file
22
storage/filters.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
as "github.com/go-ap/activitystreams"
|
||||
)
|
||||
|
||||
// Filterable
|
||||
type Filterable interface {
|
||||
Types() []as.ActivityVocabularyType
|
||||
IRIs() []as.IRI
|
||||
}
|
||||
|
||||
// Paginator
|
||||
type Paginator interface {
|
||||
QueryString() string
|
||||
BasePage() Paginator
|
||||
CurrentPage() Paginator
|
||||
NextPage() Paginator
|
||||
PrevPage() Paginator
|
||||
FirstPage() Paginator
|
||||
CurrentIndex() int
|
||||
}
|
35
storage/repository.go
Normal file
35
storage/repository.go
Normal file
|
@ -0,0 +1,35 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
as "github.com/go-ap/activitystreams"
|
||||
)
|
||||
|
||||
// Loader
|
||||
type Loader interface {
|
||||
Load(f Filterable) (as.ItemCollection, error)
|
||||
}
|
||||
// ActivityLoader
|
||||
type ActivityLoader interface {
|
||||
LoadActivities(f Filterable) (as.ItemCollection, error)
|
||||
}
|
||||
// ActorLoader
|
||||
type ActorLoader interface {
|
||||
LoadActors(f Filterable) (as.ItemCollection, error)
|
||||
}
|
||||
// ObjectLoader
|
||||
type ObjectLoader interface {
|
||||
LoadObjects(f Filterable) (as.ItemCollection, error)
|
||||
}
|
||||
// ActivitySaver
|
||||
type ActivitySaver interface {
|
||||
SaveActivity(as.Item) (as.Item, error)
|
||||
}
|
||||
// ActorSaver
|
||||
type ActorSaver interface {
|
||||
SaveActor(as.Item) (as.Item, error)
|
||||
}
|
||||
// ObjectSaver
|
||||
type ObjectSaver interface {
|
||||
SaveObject(as.Item) (as.Item, error)
|
||||
}
|
||||
|
Reference in a new issue