Documentation
¶
Overview ¶
Package bakerystorage provides an implementation of the bakery Storage interface that uses MongoDB to store items.
This is based on github.com/go-macaroon-bakery/macaroon-bakery/v3/bakery/mgorootkeystore.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MongoIndexes ¶
func MongoIndexes() []mgo.Index
MongoIndexes returns the indexes to apply to the MongoDB collection.
Types ¶
type BakeryConfig ¶
type BakeryConfig interface { InitialiseBakeryConfigOp() (txn.Op, error) GetLocalUsersKey() (*bakery.KeyPair, error) GetLocalUsersThirdPartyKey() (*bakery.KeyPair, error) GetExternalUsersThirdPartyKey() (*bakery.KeyPair, error) GetOffersThirdPartyKey() (*bakery.KeyPair, error) }
BakeryConfig defines methods used to access bakery configuration.
func NewBakeryConfig ¶
func NewBakeryConfig(collection string, collectionGetter collectionGetterFunc) BakeryConfig
NewBakeryConfig returns an instance used to access bakery configuration.
type Config ¶
type Config struct { // GetCollection returns a mongo.Collection and a function that // will close any associated resources. GetCollection func() (collection mongo.Collection, closer func()) // GetStorage returns a bakery.Storage and a function that will close // any associated resources. GetStorage func(rootKeys *mgorootkeystore.RootKeys, coll mongo.Collection, expireAfter time.Duration) (storage bakery.RootKeyStore) }
Config contains configuration for creating bakery storage with New.
type ExpirableStorage ¶
type ExpirableStorage interface { bakery.RootKeyStore // ExpireAfter returns a new ExpirableStorage that will expire // added items after the specified duration. ExpireAfter(time.Duration) ExpirableStorage }
ExpirableStorage extends bakery.Storage with the ExpireAfter method, to expire data added at the specified time.
func New ¶
func New(config Config) (ExpirableStorage, error)
New returns an implementation of bakery.Storage that stores all items in MongoDB with an expiry time.