Documentation ¶
Index ¶
- type CloudDatastore
- func New(ctx context.Context, bucketName string) (*CloudDatastore, error)
- func NewGCPWithCredentials(ctx context.Context, creds *google.Credentials, bucketName string) (*CloudDatastore, error)
- func NewS3WithConfig(ctx context.Context, bucketName string, cfg aws.Config) (*CloudDatastore, error)
- func NewWithBucket(bucket *blob.Bucket, bucketName string) *CloudDatastore
- func (cds *CloudDatastore) Close() error
- func (cds *CloudDatastore) Delete(ctx context.Context, key datastore.Key) error
- func (cds *CloudDatastore) Get(ctx context.Context, key datastore.Key) (value []byte, err error)
- func (cds *CloudDatastore) GetSize(ctx context.Context, key datastore.Key) (size int, err error)
- func (cds *CloudDatastore) Has(ctx context.Context, key datastore.Key) (exists bool, err error)
- func (cds *CloudDatastore) Put(ctx context.Context, key datastore.Key, value []byte) error
- func (cds *CloudDatastore) Query(ctx context.Context, q query.Query) (query.Results, error)
- func (cds *CloudDatastore) Sync(ctx context.Context, prefix datastore.Key) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CloudDatastore ¶
type CloudDatastore struct {
// contains filtered or unexported fields
}
implements ipfs/go-datastore CloudDatastore interface uses google/go-cloud blob.Bucket to store data
func New ¶
func New(ctx context.Context, bucketName string) (*CloudDatastore, error)
Create a new CloudDatastore using a bucket name and default parameters appropriate for the bucket type. GCS, S3, Azure, memory, and file buckets are suported. each system has its own default parameters. see https://gocloud.dev/howto/blob/ for information on each system.
bucketName should have an approppriate prefix for the bucket type. e.g.
- "gs://my-bucket" for GCS
- "s3://my-bucket" for S3
- "azblob://my-bucket" for Azure
- "file://my-bucket" for file
- "mem://my-bucket" for memory
func NewGCPWithCredentials ¶
func NewGCPWithCredentials(ctx context.Context, creds *google.Credentials, bucketName string) (*CloudDatastore, error)
NewGCPWithCredentials creates a new CloudDatastore with a GCP bucket. The user must separately authenticate with GCP and provide the credentials. bucketName should look like "my-bucket"
func NewS3WithConfig ¶
func NewS3WithConfig(ctx context.Context, bucketName string, cfg aws.Config) (*CloudDatastore, error)
NewS3WithConfig creates a new CloudDatastore with the given bucket name and aws.Config.
func NewWithBucket ¶
func NewWithBucket(bucket *blob.Bucket, bucketName string) *CloudDatastore
NewDatastore returns a new Datastore based on a google/go-cloud blob.Bucket
func (*CloudDatastore) Delete ¶
func (cds *CloudDatastore) Delete(ctx context.Context, key datastore.Key) error
Delete removes a key from the Datastore
func (*CloudDatastore) Get ¶
func (cds *CloudDatastore) Get(ctx context.Context, key datastore.Key) (value []byte, err error)
Get retrieves a value from the Datastore
func (*CloudDatastore) GetSize ¶
func (cds *CloudDatastore) GetSize(ctx context.Context, key datastore.Key) (size int, err error)
GetSize returns the size of the `value` named by `key`. In some contexts, it may be much cheaper to only get the size of the value rather than retrieving the value itself.
func (*CloudDatastore) Has ¶
func (cds *CloudDatastore) Has(ctx context.Context, key datastore.Key) (exists bool, err error)
Has returns whether the `key` is mapped to a `value`.
func (*CloudDatastore) Put ¶
func (cds *CloudDatastore) Put(ctx context.Context, key datastore.Key, value []byte) error
Put stores a value in the Datastore