Esempio n. 1
0
func newMongoStorage(cfg config) (blobserver.Storage, error) {
	session, err := getConnection(cfg.url())
	if err != nil {
		return nil, err
	}
	c := session.DB(cfg.database).C(cfg.collection)

	return blobserver.Storage(&mongoStorage{c: c}), nil

}
Esempio n. 2
0
	"os"

	"camlistore.org/pkg/blob"
	"camlistore.org/pkg/blobserver"
	"camlistore.org/pkg/client"
	"go4.org/jsonconfig"
	"golang.org/x/net/context"
)

// remoteStorage is a blobserver.Storage proxy for a remote camlistore
// blobserver.
type remoteStorage struct {
	client *client.Client
}

var _ = blobserver.Storage((*remoteStorage)(nil))

// NewFromClient returns a new Storage implementation using the
// provided Camlistore client.
func NewFromClient(c *client.Client) blobserver.Storage {
	return &remoteStorage{client: c}
}

func newFromConfig(_ blobserver.Loader, config jsonconfig.Obj) (storage blobserver.Storage, err error) {
	url := config.RequiredString("url")
	auth := config.RequiredString("auth")
	skipStartupCheck := config.OptionalBool("skipStartupCheck", false)
	if err := config.Validate(); err != nil {
		return nil, err
	}