bakerystorage

package
v0.0.0-...-6cf1bc9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 13, 2016 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package bakerystorage provides an implementation of the bakery Storage interface that uses MongoDB to store items.

This is based on gopkg.in/macaroon-bakery.v1/bakery/mgostorage.

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 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())
}

Config contains configuration for creating bakery storage with New.

func (Config) Validate

func (c Config) Validate() error

Validate validates the configuration.

type ExpirableStorage

type ExpirableStorage interface {
	bakery.Storage

	// ExpireAt returns a new ExpirableStorage that will expire
	// added items at the specified time.
	ExpireAt(time.Time) ExpirableStorage
}

ExpirableStorage extends bakery.Storage with the ExpireAt 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL