Documentation
¶
Index ¶
- Constants
- Variables
- func LocationType(loc string) string
- type ACLEntry
- type APIError
- type Bucket
- type ComposeSource
- type ConfigProvider
- type CopyRequest
- type HMACKey
- type Handler
- func (h *Handler) ExtractOperation(c *echo.Context) string
- func (h *Handler) ExtractResource(c *echo.Context) string
- func (h *Handler) GetSupportedOperations() []string
- func (h *Handler) Handler() echo.HandlerFunc
- func (h *Handler) MatchPriority() int
- func (h *Handler) Name() string
- func (h *Handler) Reset()
- func (h *Handler) Restore(ctx context.Context, data []byte) error
- func (h *Handler) RouteMatcher() service.Matcher
- func (h *Handler) Shutdown(ctx context.Context)
- func (h *Handler) Snapshot(ctx context.Context) []byte
- func (h *Handler) StartWorker(ctx context.Context) error
- type IAMBinding
- type IAMPolicy
- type InMemoryBackend
- func (b *InMemoryBackend) AbortMultipart(bucket, name, id string) error
- func (b *InMemoryBackend) AddNotification(bucket string, n Notification) (Notification, error)
- func (b *InMemoryBackend) AppendUpload(id string, offset int64, chunk []byte, total int64) (UploadProgress, error)
- func (b *InMemoryBackend) BucketLocation(name string) (string, bool)
- func (b *InMemoryBackend) BucketProject(name string) (string, bool)
- func (b *InMemoryBackend) CancelUpload(id string) error
- func (b *InMemoryBackend) CompleteMultipart(bucket, name, id string, parts []PartRef, pre Preconds, keySHA string) (*Object, error)
- func (b *InMemoryBackend) ComposeObject(bucket, dst string, sources []ComposeSource, meta Patch, pre Preconds, ...) (*Object, error)
- func (b *InMemoryBackend) CopyObject(req CopyRequest) (*Object, error)
- func (b *InMemoryBackend) CreateBucket(project string, p Patch) (*Bucket, error)
- func (b *InMemoryBackend) CreateHMACKey(project, email string) (*HMACKey, error)
- func (b *InMemoryBackend) DeleteACL(t aclTarget, entity string) error
- func (b *InMemoryBackend) DeleteBucket(name string, pre Preconds) error
- func (b *InMemoryBackend) DeleteHMACKey(project, id string) error
- func (b *InMemoryBackend) DeleteNotification(bucket, id string) error
- func (b *InMemoryBackend) DeleteObject(bucket, name string, gen int64, pre Preconds) error
- func (b *InMemoryBackend) GetACL(t aclTarget, entity string) (ACLEntry, int64, error)
- func (b *InMemoryBackend) GetBucket(name string, pre Preconds) (*Bucket, error)
- func (b *InMemoryBackend) GetHMACKey(project, id string) (*HMACKey, error)
- func (b *InMemoryBackend) GetIAMPolicy(name string, requestedVersion int) (IAMPolicy, error)
- func (b *InMemoryBackend) GetNotification(bucket, id string) (Notification, error)
- func (b *InMemoryBackend) GetObject(bucket, name string, gen int64, pre Preconds) (*Object, error)
- func (b *InMemoryBackend) GetSoftDeletedBucket(name string, gen int64) (*Bucket, error)
- func (b *InMemoryBackend) GetSoftDeletedObject(bucket, name string, gen int64) (*Object, error)
- func (b *InMemoryBackend) InitiateMultipart(bucket, name string, meta Patch) (string, error)
- func (b *InMemoryBackend) ListACL(t aclTarget) ([]ACLEntry, int64, error)
- func (b *InMemoryBackend) ListBuckets(project, prefix, token string, limit int) page.Page[*Bucket]
- func (b *InMemoryBackend) ListHMACKeys(project, email, token string, limit int, showDeleted bool) page.Page[*HMACKey]
- func (b *InMemoryBackend) ListNotifications(bucket string) ([]Notification, error)
- func (b *InMemoryBackend) ListObjects(bucket string, opts ListOptions) (ListResult, error)
- func (b *InMemoryBackend) ListSoftDeletedBuckets(project, prefix, token string, limit int) page.Page[*Bucket]
- func (b *InMemoryBackend) LockRetentionPolicy(name string, metageneration int64) (*Bucket, error)
- func (b *InMemoryBackend) NoteRead(bucket, name string, gen int64)
- func (b *InMemoryBackend) ObserveObjects(fn ObjectObserver)
- func (b *InMemoryBackend) PutObject(bucket, name string, data []byte, p Patch, pre Preconds) (*Object, error)
- func (b *InMemoryBackend) Reset()
- func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
- func (b *InMemoryBackend) RestoreBucket(name string, gen int64) (*Bucket, error)
- func (b *InMemoryBackend) RestoreObject(bucket, name string, gen int64, pre Preconds, copySourceACL bool) (*Object, error)
- func (b *InMemoryBackend) RunJanitor(ctx context.Context, interval time.Duration)
- func (b *InMemoryBackend) RunLifecycle()
- func (b *InMemoryBackend) SetACL(t aclTarget, e ACLEntry) (ACLEntry, int64, error)
- func (b *InMemoryBackend) SetClock(fn func() time.Time)
- func (b *InMemoryBackend) SetIAMPolicy(name string, pol IAMPolicy) (IAMPolicy, error)
- func (b *InMemoryBackend) SetKMSChecker(c cmek.Checker)
- func (b *InMemoryBackend) SetKeyResolver(fn KeyResolver)
- func (b *InMemoryBackend) SetNotifier(n Notifier)
- func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
- func (b *InMemoryBackend) StartUpload(bucket, name string, meta Patch, pre Preconds) (string, error)
- func (b *InMemoryBackend) UpdateBucket(name string, p Patch, replace bool, pre Preconds) (*Bucket, error)
- func (b *InMemoryBackend) UpdateHMACKey(project, id, state string) (*HMACKey, error)
- func (b *InMemoryBackend) UpdateObject(bucket, name string, gen int64, p Patch, replace bool, pre Preconds) (*Object, error)
- func (b *InMemoryBackend) UploadPart(bucket, name, id string, number int, data []byte, keySHA string) (string, error)
- type KeyResolver
- type ListOptions
- type ListResult
- type Notification
- type Notifier
- type Object
- type ObjectEvent
- type ObjectEventType
- type ObjectObserver
- type ObjectRetention
- type PartRef
- type Patch
- type Preconds
- type Provider
- type Settings
- type UploadProgress
Constants ¶
const DefaultPort = 4443
DefaultPort is the dedicated listener's default TCP port.
Variables ¶
var ErrNilAppContext = errors.New("gcpstorage: nil app context")
ErrNilAppContext is returned when Init is called with a nil AppContext.
var ErrSnapshotBucketNull = errors.New("gcpstorage: restore snapshot: bucket is null")
ErrSnapshotBucketNull is returned by Restore when a snapshot holds a null bucket.
Functions ¶
func LocationType ¶
LocationType returns the GCS locationType of a bucket location.
Types ¶
type ACLEntry ¶
ACLEntry is one access-control entry; the derived fields (email, domain, projectTeam) are rendered from Entity.
type Bucket ¶
type Bucket struct {
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
SoftDeleteTime time.Time `json:"softDeleteTime,omitzero"`
HardDeleteTime time.Time `json:"hardDeleteTime,omitzero"`
Objects map[string][]*Object `json:"objects"`
SoftDeleted []*Object `json:"softDeleted,omitempty"`
Notifications []Notification `json:"notifications,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Config map[string]jsontext.Value `json:"config,omitempty"`
Project string `json:"project"`
Name string `json:"name"`
Location string `json:"location"`
StorageClass string `json:"storageClass"`
ACL []ACLEntry `json:"acl,omitempty"`
DefaultObjectACL []ACLEntry `json:"defaultObjectAcl,omitempty"`
IAM IAMPolicy `json:"iam"`
Metageneration int64 `json:"metageneration"`
Generation int64 `json:"generation,omitempty"`
NotifSeq int64 `json:"notifSeq,omitempty"`
Versioning bool `json:"versioning,omitempty"`
DefaultEventBasedHold bool `json:"defaultEventBasedHold,omitempty"`
}
Bucket is a bucket with all of its object versions.
type ComposeSource ¶
ComposeSource is one source object of a compose request.
type ConfigProvider ¶
type ConfigProvider interface {
GetGCPStorageSettings() Settings
}
ConfigProvider extracts GCS configuration from the AppContext Config.
type CopyRequest ¶
type CopyRequest struct {
DstPre Preconds
SrcPre Preconds
Meta Patch
ACL Patch
SrcBucket string
SrcName string
DstBucket string
DstName string
SrcKeySHA string
DstKeySHA string
DstKMSKey string
SrcGeneration int64
}
CopyRequest describes a copy or rewrite.
type HMACKey ¶
type HMACKey struct {
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
AccessID string `json:"accessId"`
Secret string `json:"secret"`
Project string `json:"project"`
ServiceAccountEmail string `json:"serviceAccountEmail"`
State string `json:"state"`
}
HMACKey is a Cloud Storage HMAC key (storage#hmacKeyMetadata plus its secret).
type Handler ¶
type Handler struct {
Backend *InMemoryBackend
Port int
// RequireAuth rejects requests that are neither signed nor carry an Authorization header.
RequireAuth bool
// contains filtered or unexported fields
}
Handler serves the Cloud Storage JSON and XML APIs.
func NewHandler ¶
func NewHandler(backend *InMemoryBackend) *Handler
NewHandler creates a Handler; callers override Port from Settings.
func (*Handler) ExtractOperation ¶
ExtractOperation returns the operation name for metrics.
func (*Handler) ExtractResource ¶
ExtractResource returns bucket[/object] for metrics.
func (*Handler) GetSupportedOperations ¶
GetSupportedOperations lists the supported operations.
func (*Handler) Handler ¶
func (h *Handler) Handler() echo.HandlerFunc
Handler returns the Echo handler for all GCS requests.
func (*Handler) MatchPriority ¶
MatchPriority is irrelevant because RouteMatcher never matches.
func (*Handler) RouteMatcher ¶
RouteMatcher never matches: GCS runs on its own listener.
func (*Handler) Shutdown ¶
Shutdown stops the dedicated listener, forcing a close if graceful shutdown fails.
type IAMBinding ¶
type IAMBinding struct {
Condition jsontext.Value `json:"condition,omitempty"`
Role string `json:"role"`
Members []string `json:"members"`
}
IAMBinding is one role binding of a bucket IAM policy.
type IAMPolicy ¶
type IAMPolicy struct {
Etag string `json:"etag"`
Bindings []IAMBinding `json:"bindings"`
Version int `json:"version"`
}
IAMPolicy is a bucket IAM policy.
type InMemoryBackend ¶
type InMemoryBackend struct {
// Audit records Cloud Audit Logs entries for bucket and object changes.
Audit gcpaudit.Emitter
// contains filtered or unexported fields
}
InMemoryBackend holds all buckets, objects and resumable upload sessions under one lock.
func NewInMemoryBackend ¶
func NewInMemoryBackend() *InMemoryBackend
NewInMemoryBackend creates an empty backend.
func (*InMemoryBackend) AbortMultipart ¶
func (b *InMemoryBackend) AbortMultipart(bucket, name, id string) error
AbortMultipart discards an upload and its parts.
func (*InMemoryBackend) AddNotification ¶
func (b *InMemoryBackend) AddNotification(bucket string, n Notification) (Notification, error)
AddNotification validates and stores a notificationConfig; the topic must exist.
func (*InMemoryBackend) AppendUpload ¶
func (b *InMemoryBackend) AppendUpload(id string, offset int64, chunk []byte, total int64) (UploadProgress, error)
AppendUpload appends chunk at offset. total is the declared object size or -1 when unknown; once the received bytes reach it the object is committed.
func (*InMemoryBackend) BucketLocation ¶
func (b *InMemoryBackend) BucketLocation(name string) (string, bool)
BucketLocation returns the location of a bucket, and false when it does not exist.
func (*InMemoryBackend) BucketProject ¶
func (b *InMemoryBackend) BucketProject(name string) (string, bool)
BucketProject returns the project that owns a bucket, and false when it does not exist.
func (*InMemoryBackend) CancelUpload ¶
func (b *InMemoryBackend) CancelUpload(id string) error
CancelUpload discards a resumable session.
func (*InMemoryBackend) CompleteMultipart ¶
func (b *InMemoryBackend) CompleteMultipart( bucket, name, id string, parts []PartRef, pre Preconds, keySHA string, ) (*Object, error)
CompleteMultipart assembles the listed parts into the object and discards the upload.
func (*InMemoryBackend) ComposeObject ¶
func (b *InMemoryBackend) ComposeObject( bucket, dst string, sources []ComposeSource, meta Patch, pre Preconds, keySHA string, ) (*Object, error)
ComposeObject concatenates sources (same bucket) into dst.
func (*InMemoryBackend) CopyObject ¶
func (b *InMemoryBackend) CopyObject(req CopyRequest) (*Object, error)
CopyObject copies an object. A nil Meta inherits the source metadata; otherwise Meta supplies the destination metadata.
func (*InMemoryBackend) CreateBucket ¶
func (b *InMemoryBackend) CreateBucket(project string, p Patch) (*Bucket, error)
CreateBucket creates a bucket in project from the request body p.
func (*InMemoryBackend) CreateHMACKey ¶
func (b *InMemoryBackend) CreateHMACKey(project, email string) (*HMACKey, error)
CreateHMACKey creates an ACTIVE key for a service account; the returned copy carries the secret.
func (*InMemoryBackend) DeleteACL ¶
func (b *InMemoryBackend) DeleteACL(t aclTarget, entity string) error
DeleteACL removes the entry for entity.
func (*InMemoryBackend) DeleteBucket ¶
func (b *InMemoryBackend) DeleteBucket(name string, pre Preconds) error
DeleteBucket deletes an empty bucket.
func (*InMemoryBackend) DeleteHMACKey ¶
func (b *InMemoryBackend) DeleteHMACKey(project, id string) error
DeleteHMACKey marks an INACTIVE key DELETED.
func (*InMemoryBackend) DeleteNotification ¶
func (b *InMemoryBackend) DeleteNotification(bucket, id string) error
DeleteNotification removes a notificationConfig.
func (*InMemoryBackend) DeleteObject ¶
func (b *InMemoryBackend) DeleteObject(bucket, name string, gen int64, pre Preconds) error
DeleteObject deletes the live version (archiving it in a versioned bucket) or, with gen set, permanently removes that generation.
func (*InMemoryBackend) GetACL ¶
func (b *InMemoryBackend) GetACL(t aclTarget, entity string) (ACLEntry, int64, error)
GetACL returns the entry for entity.
func (*InMemoryBackend) GetBucket ¶
func (b *InMemoryBackend) GetBucket(name string, pre Preconds) (*Bucket, error)
GetBucket returns the bucket metadata.
func (*InMemoryBackend) GetHMACKey ¶
func (b *InMemoryBackend) GetHMACKey(project, id string) (*HMACKey, error)
GetHMACKey returns key metadata (the secret is blanked).
func (*InMemoryBackend) GetIAMPolicy ¶
func (b *InMemoryBackend) GetIAMPolicy(name string, requestedVersion int) (IAMPolicy, error)
GetIAMPolicy returns the bucket IAM policy; policies with conditional bindings need requestedVersion >= 3.
func (*InMemoryBackend) GetNotification ¶
func (b *InMemoryBackend) GetNotification(bucket, id string) (Notification, error)
GetNotification returns one notificationConfig.
func (*InMemoryBackend) GetObject ¶
GetObject returns generation gen of an object, or the live one when gen is 0.
func (*InMemoryBackend) GetSoftDeletedBucket ¶
func (b *InMemoryBackend) GetSoftDeletedBucket(name string, gen int64) (*Bucket, error)
GetSoftDeletedBucket returns generation gen of a soft-deleted bucket.
func (*InMemoryBackend) GetSoftDeletedObject ¶
func (b *InMemoryBackend) GetSoftDeletedObject(bucket, name string, gen int64) (*Object, error)
GetSoftDeletedObject returns a soft-deleted generation.
func (*InMemoryBackend) InitiateMultipart ¶
func (b *InMemoryBackend) InitiateMultipart(bucket, name string, meta Patch) (string, error)
InitiateMultipart opens an XML API multipart upload and returns its upload id.
func (*InMemoryBackend) ListACL ¶
func (b *InMemoryBackend) ListACL(t aclTarget) ([]ACLEntry, int64, error)
ListACL returns the entries of the targeted ACL and the resolved object generation.
func (*InMemoryBackend) ListBuckets ¶
ListBuckets lists the project's buckets whose names start with prefix.
func (*InMemoryBackend) ListHMACKeys ¶
func (b *InMemoryBackend) ListHMACKeys( project, email, token string, limit int, showDeleted bool, ) page.Page[*HMACKey]
ListHMACKeys lists a project's keys, optionally for one service account and including DELETED ones.
func (*InMemoryBackend) ListNotifications ¶
func (b *InMemoryBackend) ListNotifications(bucket string) ([]Notification, error)
ListNotifications returns a bucket's notificationConfigs.
func (*InMemoryBackend) ListObjects ¶
func (b *InMemoryBackend) ListObjects(bucket string, opts ListOptions) (ListResult, error)
ListObjects lists objects in name order, collapsing delimited prefixes.
func (*InMemoryBackend) ListSoftDeletedBuckets ¶
func (b *InMemoryBackend) ListSoftDeletedBuckets(project, prefix, token string, limit int) page.Page[*Bucket]
ListSoftDeletedBuckets lists the project's soft-deleted bucket generations.
func (*InMemoryBackend) LockRetentionPolicy ¶
func (b *InMemoryBackend) LockRetentionPolicy(name string, metageneration int64) (*Bucket, error)
LockRetentionPolicy irreversibly locks the bucket's retention policy.
func (*InMemoryBackend) NoteRead ¶
func (b *InMemoryBackend) NoteRead(bucket, name string, gen int64)
NoteRead records a data read of an object; Autoclass returns the object to Standard storage on a read.
func (*InMemoryBackend) ObserveObjects ¶
func (b *InMemoryBackend) ObserveObjects(fn ObjectObserver)
ObserveObjects registers fn to see every object change from now on.
func (*InMemoryBackend) Restore ¶
func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error
Restore loads backend state from a snapshot.
func (*InMemoryBackend) RestoreBucket ¶
func (b *InMemoryBackend) RestoreBucket(name string, gen int64) (*Bucket, error)
RestoreBucket brings a soft-deleted bucket back under its original name.
func (*InMemoryBackend) RestoreObject ¶
func (b *InMemoryBackend) RestoreObject( bucket, name string, gen int64, pre Preconds, copySourceACL bool, ) (*Object, error)
RestoreObject makes a soft-deleted generation live again as a new generation.
func (*InMemoryBackend) RunJanitor ¶
func (b *InMemoryBackend) RunJanitor(ctx context.Context, interval time.Duration)
RunJanitor sweeps lifecycle rules every interval until ctx ends.
func (*InMemoryBackend) RunLifecycle ¶
func (b *InMemoryBackend) RunLifecycle()
RunLifecycle applies every bucket's lifecycle rules once and purges expired soft-deleted objects.
func (*InMemoryBackend) SetACL ¶
func (b *InMemoryBackend) SetACL(t aclTarget, e ACLEntry) (ACLEntry, int64, error)
SetACL inserts the entry or changes the role of the existing entry for the same entity.
func (*InMemoryBackend) SetClock ¶
func (b *InMemoryBackend) SetClock(fn func() time.Time)
SetClock replaces the time source used for timestamps, retention, lifecycle and signed-URL expiry.
func (*InMemoryBackend) SetIAMPolicy ¶
func (b *InMemoryBackend) SetIAMPolicy(name string, pol IAMPolicy) (IAMPolicy, error)
SetIAMPolicy replaces the bucket IAM policy; a non-empty etag must match.
func (*InMemoryBackend) SetKMSChecker ¶
func (b *InMemoryBackend) SetKMSChecker(c cmek.Checker)
SetKMSChecker validates Cloud KMS keys on buckets and objects; nil disables validation.
func (*InMemoryBackend) SetKeyResolver ¶
func (b *InMemoryBackend) SetKeyResolver(fn KeyResolver)
SetKeyResolver wires the service-account key lookup used to verify GOOG4-RSA-SHA256 and V2 signatures.
func (*InMemoryBackend) SetNotifier ¶
func (b *InMemoryBackend) SetNotifier(n Notifier)
SetNotifier wires the Pub/Sub publisher that delivers notificationConfigs.
func (*InMemoryBackend) Snapshot ¶
func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte
Snapshot serialises the backend state. In-flight resumable sessions are not persisted.
func (*InMemoryBackend) StartUpload ¶
func (b *InMemoryBackend) StartUpload(bucket, name string, meta Patch, pre Preconds) (string, error)
StartUpload opens a resumable upload session and returns its id.
func (*InMemoryBackend) UpdateBucket ¶
func (b *InMemoryBackend) UpdateBucket(name string, p Patch, replace bool, pre Preconds) (*Bucket, error)
UpdateBucket applies a PATCH (replace=false) or PUT (replace=true) body.
func (*InMemoryBackend) UpdateHMACKey ¶
func (b *InMemoryBackend) UpdateHMACKey(project, id, state string) (*HMACKey, error)
UpdateHMACKey switches a key between ACTIVE and INACTIVE.
func (*InMemoryBackend) UpdateObject ¶
func (b *InMemoryBackend) UpdateObject( bucket, name string, gen int64, p Patch, replace bool, pre Preconds, ) (*Object, error)
UpdateObject applies a PATCH (replace=false) or PUT (replace=true) body.
func (*InMemoryBackend) UploadPart ¶
func (b *InMemoryBackend) UploadPart(bucket, name, id string, number int, data []byte, keySHA string) (string, error)
UploadPart stores one part and returns its ETag; keySHA must equal the key the upload was initiated with.
type KeyResolver ¶
KeyResolver returns the RSA public keys of a service account (by email) for signed-URL verification.
type ListOptions ¶
type ListOptions struct {
Prefix string
Delimiter string
StartOffset string
EndOffset string
PageToken string
MatchGlob string
MaxResults int
Versions bool
SoftDeleted bool
IncludeTrailingDelimiter bool
IncludeFolders bool
Lookahead bool
}
ListOptions are the object list parameters.
type ListResult ¶
ListResult is one page of objects and collapsed prefixes.
type Notification ¶
type Notification struct {
CustomAttributes map[string]string `json:"customAttributes,omitempty"`
ID string `json:"id"`
Topic string `json:"topic"`
ObjectNamePrefix string `json:"objectNamePrefix,omitempty"`
PayloadFormat string `json:"payloadFormat"`
EventTypes []string `json:"eventTypes,omitempty"`
}
Notification is a bucket notificationConfig (storage#notification).
type Notifier ¶
type Notifier interface {
TopicExists(topic string) bool
Publish(topic string, data []byte, attrs map[string]string) error
}
Notifier publishes bucket notifications to Pub/Sub topics ("projects/P/topics/T"); injected at wiring.
type Object ¶
type Object struct {
Created time.Time `json:"created"`
Updated time.Time `json:"updated"`
Deleted time.Time `json:"deleted"`
CustomTime time.Time `json:"customTime"`
HoldReleased time.Time `json:"holdReleased"`
SoftDeleteTime time.Time `json:"softDeleteTime"`
HardDeleteTime time.Time `json:"hardDeleteTime"`
ClassUpdated time.Time `json:"classUpdated"`
Accessed time.Time `json:"accessed,omitzero"`
Metadata map[string]string `json:"metadata,omitempty"`
ContentLanguage string `json:"contentLanguage,omitempty"`
CRC32C string `json:"crc32c"`
ContentType string `json:"contentType"`
ContentEncoding string `json:"contentEncoding,omitempty"`
ContentDisposition string `json:"contentDisposition,omitempty"`
Bucket string `json:"bucket"`
CacheControl string `json:"cacheControl,omitempty"`
StorageClass string `json:"storageClass"`
MD5 string `json:"md5,omitempty"`
PartsETag string `json:"partsEtag,omitempty"`
Name string `json:"name"`
CustomerKeySHA256 string `json:"customerKeySha256,omitempty"`
KMSKeyName string `json:"kmsKeyName,omitempty"`
ObjectRetention *ObjectRetention `json:"objectRetention,omitempty"`
Data []byte `json:"data"`
ACL []ACLEntry `json:"acl,omitempty"`
Generation int64 `json:"generation"`
Metageneration int64 `json:"metageneration"`
ComponentCount int64 `json:"componentCount,omitempty"`
TemporaryHold bool `json:"temporaryHold,omitempty"`
EventBasedHold bool `json:"eventBasedHold,omitempty"`
// contains filtered or unexported fields
}
Object is one stored object version. A version whose Deleted time is set is noncurrent; the live version, if any, is always last in its slice.
type ObjectEvent ¶
type ObjectEvent struct {
Time time.Time
Object *Object
Type ObjectEventType
// OverwroteGen is the replaced generation on a finalize; OverwrittenByGen the replacing one on delete/archive.
OverwroteGen int64
OverwrittenByGen int64
}
ObjectEvent describes one object change; Object is a private copy.
func (ObjectEvent) Data ¶
func (e ObjectEvent) Data() jsontext.Value
Data is the event payload: the object resource, as the Cloud Storage JSON API renders it.
type ObjectEventType ¶
type ObjectEventType string
ObjectEventType names a change to an object, matching the suffix of the google.cloud.storage.object.v1 event types.
const ( // ObjectFinalized is a new object (or generation) becoming readable. ObjectFinalized ObjectEventType = "finalized" // ObjectDeleted is an object generation being permanently removed. ObjectDeleted ObjectEventType = "deleted" // ObjectArchived is the live generation of a versioned bucket becoming noncurrent. ObjectArchived ObjectEventType = "archived" // ObjectMetadataUpdated is a metadata change to an existing generation. ObjectMetadataUpdated ObjectEventType = "metadataUpdated" )
type ObjectObserver ¶
type ObjectObserver func(ObjectEvent)
ObjectObserver is called after an object change is committed, outside the backend lock.
type ObjectRetention ¶
type ObjectRetention struct {
RetainUntil time.Time `json:"retainUntil"`
Mode string `json:"mode"`
}
ObjectRetention is the retention lock of one object.
type Patch ¶
Patch is a decoded JSON request body, keyed by field name. A null value clears the field, as in a JSON merge patch.
type Provider ¶
type Provider struct{}
Provider implements service.Provider for Google Cloud Storage. Like the Azure services it runs on its own listener (see Handler.StartWorker) and never matches on the shared AWS router.
func (*Provider) Init ¶
func (p *Provider) Init(ctx *service.AppContext) (service.Registerable, error)
Init creates the backend and handler; the port is bound in StartWorker.
type Settings ¶
type Settings struct {
RequireAuth bool `` //nolint:lll // config struct tags are intentionally verbose
/* 237-byte string literal not displayed */
Port int `` //nolint:lll // config struct tags are intentionally verbose
/* 192-byte string literal not displayed */
}
Settings holds service-level configuration, embedded in the root CLI command as CLI.GCPStorage.
func DefaultSettings ¶
func DefaultSettings() Settings
DefaultSettings returns the settings used when no ConfigProvider is available.
type UploadProgress ¶
UploadProgress reports a session's state after an append.
Source Files
¶
- acl.go
- acl_store.go
- audit.go
- autoclass.go
- bucket_softdelete.go
- clock.go
- cmek.go
- cors.go
- csek.go
- errors.go
- events.go
- glob.go
- handler.go
- handler_acl.go
- handler_bucket.go
- handler_object.go
- handler_upload.go
- handler_xml.go
- handler_xml_ext.go
- hmac.go
- iam.go
- lifecycle.go
- list.go
- models.go
- multipart.go
- notifications.go
- object_retention.go
- patch.go
- persistence.go
- preconds.go
- provider.go
- retention.go
- route.go
- settings.go
- signing.go
- store.go
- store_ext.go
- transcode.go
- util.go
- wire.go