s3

package module
v0.0.0-...-a181de0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: MIT Imports: 12 Imported by: 0

README

go-ds-s3/s3

s3 is an IPFS datastore implementation for amazon's S3 service.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Datastore

type Datastore struct {
	Path   string
	Bucket string
	Region string
	// contains filtered or unexported fields
}

Datastore is an implementation of the IPFS Datastore interface for Amazon S3 (Simple Storage Service)

func NewDatastore

func NewDatastore(bucketName string, options ...func(o *Options)) *Datastore

NewDatastore creates a new datastore, accepting zero or more functions that modify options

func (*Datastore) Batch

func (ds *Datastore) Batch() (datastore.Batch, error)

Batch is an additional required method of the Batching interface, currently unsupported TODO - implement batching interface.

func (*Datastore) Delete

func (ds *Datastore) Delete(key datastore.Key) error

Delete a key from the store

func (*Datastore) Get

func (ds *Datastore) Get(key datastore.Key) (value interface{}, err error)

Get an object from the store

func (*Datastore) Has

func (ds *Datastore) Has(key datastore.Key) (exists bool, err error)

Has checks for the presence of a key within the store

func (*Datastore) Put

func (ds *Datastore) Put(key datastore.Key, value interface{}) error

Put an object into the store

func (*Datastore) Query

func (ds *Datastore) Query(q query.Query) (query.Results, error)

Query the store

type Options

type Options struct {
	// Scope to a specific "folder" within the bucket without leading or trailing slashes. eg "folder" or "folder/subfolder"
	Path string
	// The AWS region this bucket is located in. Default regin since March 8, 2013 is "us-west-2"
	// see: http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region for regions list
	Region string
	// a valid access key for the named bucket is required, defaults to AWS_ACCESS_KEY_ID ENV variable
	AccessKey string
	// a valid access key for the named bucket is required, defaults to AWS_SECRET_ACCESS_KEY ENV variable
	AccessSecret string
	// AccessToken is only required when using temporary credentials, defaults to AWS_SESSION_TOKEN ENV variable
	AccessToken string
}

Options configures a Datastore. DefaultOptions sets default values which can be modified by passing func(s) to NewDatastore

func DefaultOptions

func DefaultOptions() *Options

DefaultOptions is the base set of options provided to New()

Jump to

Keyboard shortcuts

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