Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // KeyBase is the pool of characters to be used when randomly generating object keys. KeyBase = env.String("WORMHOL_OBJECT_KEY_BASE", "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz", env.Optional) // KeyLength is the object key length in characters. KeyLength = env.Int("WORMHOL_OBJECT_KEY_LENGTH", 5, env.Optional) // NameLengthMin is the minimum allowed object name length in characters. NameLengthMin = env.Int("WORMHOL_OBJECT_NAME_LENGTH_MIN", 1, env.Optional) // NameLengthMax is the maximum allowed object name length in characters. NameLengthMax = env.Int("WORMHOL_OBJECT_NAME_LENGTH_MAX", 255, env.Optional) // SizeMin is the minimum allowed object size in bytes. SizeMin = int64(env.Int("WORMHOL_OBJECT_SIZE_MIN", 1, env.Optional)) // SizeMax is the maximum allowed object size in bytes. SizeMax = int64(env.Int("WORMHOL_OBJECT_SIZE_MAX", 5e9, env.Optional)) ErrObjectNotFound = errors.New("Object not found") )
Functions ¶
func GenerateUniqueKey ¶
func GenerateUniqueKey(keyAvailabilityChecker KeyAvailabilityChecker) (*string, error)
GenerateUniqueKey finds a unique object key using keyAvailabilityChecker. There is the possibility for a race condition since we don't do locking. In those cases, storage providers will override the first object with the new one. Not ideal, but there's no simple enough solution.
Types ¶
type KeyAvailabilityChecker ¶
KeyAvailabilityChecker defines a function for checking whether an object key is available. Must return true if the object key is available for use during object creation.
type Object ¶
type Object struct { // Key uniquely identifies the object. Key *string `json:"key"` // Name is the name of the object. Name *string `json:"name,omitempty"` // SizeBytes is the binary size of the object in bytes. SizeBytes *int64 `json:"size,omitempty"` // CreatedAt is the object creation timestamp. CreatedAt *time.Time `json:"created_at,omitempty"` // PresignedRequest holds the details used for putting/getting the object to/from the storage provider. PresignedRequest *PresignedRequest `json:"presigned_request,omitempty"` }
Object represents a single Wormhol object.
type PresignedRequest ¶
type PresignedRequest struct { // URL is the request URL the client should use for putting/getting the object. URL *string `json:"url,omitempty"` // Headers is the request headers the client should use for putting/getting the object. Headers *map[string]string `json:"headers,omitempty"` }
PresignedRequest holds the details used for putting/getting an object to/from the storage provider.
Click to show internal directories.
Click to hide internal directories.