Documentation
¶
Index ¶
- func BucketSchemes() []string
- func RegisterBucket(ctx context.Context, scheme string, init_func BucketInitializationFunc) error
- func RegisterGoCloudBuckets(ctx context.Context) error
- type Attributes
- type BlobBucket
- func (b *BlobBucket) Attributes(ctx context.Context, path string) (*Attributes, error)
- func (b *BlobBucket) Close() error
- func (b *BlobBucket) Delete(ctx context.Context, key string) error
- func (b *BlobBucket) GatherPictures(ctx context.Context, uris ...string) iter.Seq2[string, error]
- func (b *BlobBucket) NewReader(ctx context.Context, key string, opts any) (io.ReadSeekCloser, error)
- func (b *BlobBucket) NewWriter(ctx context.Context, key string, opts any) (io.WriteCloser, error)
- type Bucket
- type BucketInitializationFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BucketSchemes ¶
func BucketSchemes() []string
BucketSchemes returns the list of schemes that have been registered.
func RegisterBucket ¶
func RegisterBucket(ctx context.Context, scheme string, init_func BucketInitializationFunc) error
RegisterBucket registers 'scheme' as a key pointing to 'init_func' in an internal lookup table used to create new `Bucket` instances by the `NewBucket` method.
func RegisterGoCloudBuckets ¶
RegisterGoCloudBuckets will explicitly register all the schemes associated with the `gocloud.dev/blob.Bucket` interface.
Types ¶
type Attributes ¶
type BlobBucket ¶
type BlobBucket struct { Bucket // contains filtered or unexported fields }
BlobBucket implements the `Bucket` interface using a `gocloud.dev/blob.Bucket` instance.
func (*BlobBucket) Attributes ¶
func (b *BlobBucket) Attributes(ctx context.Context, path string) (*Attributes, error)
Attributes returns an `Attributes` struct for the record named 'key' in'b'.
func (*BlobBucket) Delete ¶
func (b *BlobBucket) Delete(ctx context.Context, key string) error
Delete removes the record named 'key' in 'b'.
func (*BlobBucket) GatherPictures ¶
GatherPictures will return a iterator listing items in 'b'
func (*BlobBucket) NewReader ¶
func (b *BlobBucket) NewReader(ctx context.Context, key string, opts any) (io.ReadSeekCloser, error)
NewReader returns an `io.ReadSeekCloser` instance for the record named 'key' in 'b'.
func (*BlobBucket) NewWriter ¶
func (b *BlobBucket) NewWriter(ctx context.Context, key string, opts any) (io.WriteCloser, error)
NewWriter returns an `io.WriterCloser` instance for writing to the record named 'key' in 'b'.
type Bucket ¶
type Bucket interface { // GatherPictures returns an iterator for listing Picturebook images URIs that can passed to the (bucket implementation's) `NewReader` method. GatherPictures(context.Context, ...string) iter.Seq2[string, error] // NewReader returns an `io.ReadSeekCloser` instance for a record in the bucket. NewReader(context.Context, string, any) (io.ReadSeekCloser, error) // NewWriter returns an `io.WriterCloser` instance for writing a record to the bucket. NewWriter(context.Context, string, any) (io.WriteCloser, error) // Delete removed a record from the bucket. Delete(context.Context, string) error // Attributes returns an `Attributes` struct for a record in the bucket. Attributes(context.Context, string) (*Attributes, error) // Close signals the implementation to wrap things up (internally). Close() error }
Bucket implements a simple interface for reading and writing Picturebook images to and from different storage implementations. It is modeled after the `gocloud.dev/blob.Bucket` interface which is what this package used to use. This simplified interface reflects the limited methods from the original interface that were used. The goal is to make it easier to implement a variety of Picturebook "sources" (or buckets) without having to implement the entirety of the `gocloud.dev/blob.Bucket` interface.
func NewBlobBucket ¶
NewBlobBucket returns a new instantiation of the `Bucket` interface using a `gocloud.dev/blob.Bucket` instance.
func NewBucket ¶
NewBucket returns a new `Bucket` instance configured by 'uri'. The value of 'uri' is parsed as a `url.URL` and its scheme is used as the key for a corresponding `BucketInitializationFunc` function used to instantiate the new `Bucket`. It is assumed that the scheme (and initialization function) have been registered by the `RegisterBucket` method.