Documentation
¶
Overview ¶
Package r2 stores package repository objects in Cloudflare R2 through its S3 API.
Index ¶
- type Credentials
- type Options
- type Store
- func (s *Store) Download(ctx context.Context, objectPath string, destination io.Writer) (pkgrepo.StoredContent, error)
- func (s *Store) List(ctx context.Context) ([]pkgrepo.StoredObject, error)
- func (s *Store) Stat(ctx context.Context, objectPath string) (pkgrepo.StoredContent, bool, error)
- func (s *Store) Upload(ctx context.Context, request pkgrepo.UploadRequest) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credentials ¶
type Credentials struct {
// AccessKeyID is the R2 API token access key.
AccessKeyID rel.Secret
// SecretAccessKey is the R2 API token secret.
SecretAccessKey rel.Secret
// SessionToken is optional for S3-compatible integration tests.
SessionToken rel.Secret
}
Credentials contains the static S3 authentication values used by R2.
type Options ¶
type Options struct {
// AccountID is the Cloudflare account that owns the bucket.
// It is required when Endpoint is empty.
AccountID string
// Endpoint overrides the account-derived S3 endpoint.
// It exists for S3-compatible integration tests.
Endpoint string
// Bucket is the existing R2 bucket name.
Bucket string
// Credentials are the least-privilege S3 API credentials.
Credentials Credentials
}
Options configures a Store.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store streams package repository objects through the AWS S3 client.
func (*Store) Download ¶
func (s *Store) Download( ctx context.Context, objectPath string, destination io.Writer, ) (pkgrepo.StoredContent, error)
Download implements pkgrepo.Store.
func (*Store) List ¶
List implements pkgrepo.Store.
func (*Store) Stat ¶
Stat implements pkgrepo.Store.
func (*Store) Upload ¶
Upload implements pkgrepo.Store.
Click to show internal directories.
Click to hide internal directories.