s3_ns

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIR_FMODE                = core.FileMode(0700 | fs.ModeDir)
	DEFAULT_MAX_STORAGE_SIZE = 100_000_000
	SUPPORTED_OPEN_FLAGS     = os.O_RDONLY | os.O_WRONLY | os.O_RDWR | os.O_APPEND | os.O_EXCL | os.O_CREATE | os.O_TRUNC
)
View Source
const (
	MISSING_ACCESS_KEY_IN_RESOL_DATA                                           = "missing .access-key in resolution data"
	MISSING_SECRET_KEY_IN_RESOL_DATA                                           = "missing .secret-key in resolution data"
	MISSING_ACCESS_KEY_SECRET_KEY_HOST_IN_RESOL_DATA_NO_PROJ_FOUND             = "missing .access-key, .secret-key and .host in resolution data (no project found to provide credentials)"
	MISSING_ACCESS_KEY_SECRET_KEY_HOST_IN_RESOL_DATA_PROJ_CANNOT_PROVIDE_CREDS = "" /* 126-byte string literal not displayed */

	MISSING_HOST_IN_RESOL_DATA                                = "missing .host in resolution data"
	HOST_SHOULD_NOT_BE_IN_RESOL_DATA_SINCE_CREDS_NOT_PROVIDED = ".host should not be in resolution data since it is provided by the project"

	MISSING_BUCKET_IN_RESOL_DATA   = "missing .bucket in resolution data"
	MISSING_PROVIDER_IN_RESOL_DATA = "missing .provider in resolution data"
)
View Source
const (
	NAMESPACE_NAME = "s3"
)
View Source
const (
	OBJECT_STORAGE_REQUEST_RATE_LIMIT_NAME = "object-storage/request"
)
View Source
const (
	PERM_METADATA_KEY = "Perm" //a user metadata key seems to require
)

Variables

View Source
var (
	ErrLockNotSupported        = errors.New("lock not supported by s3 filesystem")
	ErrCannotWriteToReadOnly   = errors.New("cannot write to read-only file")
	ErrCannotTruncateReadOnly  = errors.New("cannot truncate a read-only file")
	ErrCannotReadFromWriteOnly = errors.New("cannot read from write-only file")
)
View Source
var (
	ErrCannotResolveBucket = errors.New("cannot resolve bucket")
)
View Source
var (
	ErrOnlyS3httpsURLsSupported = errors.New("only s3:// & https:// urls are supported")
)
View Source
var (
	ErrOpenFlagNotSupported = errors.New("open flag not supported by S3 filesystem")
)

Functions

func NewS3namespace

func NewS3namespace() *core.Namespace

func S3Delete

func S3Delete(ctx *core.Context, u core.URL, readable core.Readable) error

func S3RemoveBucketPolicy

func S3RemoveBucketPolicy(ctx *core.Context, u core.URL) error

func S3SetBucketPolicy

func S3SetBucketPolicy(ctx *core.Context, u core.URL, policy core.Value) error

Types

type Bucket

type Bucket struct {
	// contains filtered or unexported fields
}

func OpenBucket

func OpenBucket(ctx *core.Context, host core.Host, opts OpenBucketOptions) (*Bucket, error)

func OpenBucketWithCredentials

func OpenBucketWithCredentials(ctx *core.Context, input OpenBucketWithCredentialsInput) (*Bucket, error)

func (*Bucket) Close

func (b *Bucket) Close()

func (*Bucket) DeleteObject

func (bucket *Bucket) DeleteObject(ctx *core.Context, key string) error

func (*Bucket) Equal

func (b *Bucket) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*Bucket) GetObject

func (b *Bucket) GetObject(ctx *core.Context, key string) (*GetObjectResponse, error)

func (*Bucket) IsMutable

func (b *Bucket) IsMutable() bool

func (*Bucket) ListObjects

func (b *Bucket) ListObjects(ctx *core.Context, key string) ([]*ObjectInfo, error)

func (*Bucket) Name

func (b *Bucket) Name() string

func (*Bucket) PrettyPrint

func (b *Bucket) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*Bucket) PutObject

func (bucket *Bucket) PutObject(ctx *core.Context, key string, body io.Reader) (*PutObjectResponse, error)

func (*Bucket) RemoveAllObjects

func (b *Bucket) RemoveAllObjects(ctx *core.Context)

func (*Bucket) ToSymbolicValue

func (b *Bucket) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type BucketMapItem

type BucketMapItem = struct {
	WithCredentials, Public *Bucket
}

type GetBucketPolicyResponse

type GetBucketPolicyResponse struct {
	// contains filtered or unexported fields
}

func S3GetBucketPolicy

func S3GetBucketPolicy(ctx *core.Context, u core.URL) (*GetBucketPolicyResponse, error)

func (*GetBucketPolicyResponse) Equal

func (r *GetBucketPolicyResponse) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*GetBucketPolicyResponse) GetGoMethod

func (resp *GetBucketPolicyResponse) GetGoMethod(name string) (*core.GoFunction, bool)

func (*GetBucketPolicyResponse) IsMutable

func (r *GetBucketPolicyResponse) IsMutable() bool

func (*GetBucketPolicyResponse) PrettyPrint

func (r *GetBucketPolicyResponse) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*GetBucketPolicyResponse) Prop

func (resp *GetBucketPolicyResponse) Prop(ctx *core.Context, name string) core.Value

func (*GetBucketPolicyResponse) PropertyNames

func (*GetBucketPolicyResponse) PropertyNames(ctx *core.Context) []string

func (*GetBucketPolicyResponse) SetProp

func (*GetBucketPolicyResponse) SetProp(ctx *core.Context, name string, value core.Value) error

func (*GetBucketPolicyResponse) ToSymbolicValue

func (resp *GetBucketPolicyResponse) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type GetObjectResponse

type GetObjectResponse struct {
	// contains filtered or unexported fields
}

func S3Get

func S3Get(ctx *core.Context, u core.URL) (*GetObjectResponse, error)

func (*GetObjectResponse) Equal

func (r *GetObjectResponse) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*GetObjectResponse) GetGoMethod

func (resp *GetObjectResponse) GetGoMethod(name string) (*core.GoFunction, bool)

func (*GetObjectResponse) IsMutable

func (r *GetObjectResponse) IsMutable() bool

func (*GetObjectResponse) PrettyPrint

func (r *GetObjectResponse) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*GetObjectResponse) Prop

func (resp *GetObjectResponse) Prop(ctx *core.Context, name string) core.Value

func (*GetObjectResponse) PropertyNames

func (*GetObjectResponse) PropertyNames(ctx *core.Context) []string

func (*GetObjectResponse) ReadAll

func (r *GetObjectResponse) ReadAll() ([]byte, error)

func (*GetObjectResponse) SetProp

func (*GetObjectResponse) SetProp(ctx *core.Context, name string, value core.Value) error

func (*GetObjectResponse) ToSymbolicValue

func (resp *GetObjectResponse) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type ObjectInfo

type ObjectInfo struct {
	minio.ObjectInfo
}

func S3List

func S3List(ctx *core.Context, u core.URL) ([]*ObjectInfo, error)

func (*ObjectInfo) Equal

func (i *ObjectInfo) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*ObjectInfo) IsMutable

func (i *ObjectInfo) IsMutable() bool

func (*ObjectInfo) PrettyPrint

func (i *ObjectInfo) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*ObjectInfo) ToSymbolicValue

func (i *ObjectInfo) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type OpenBucketOptions

type OpenBucketOptions struct {
	//if true and the host definition data of s3Host is an object without the .access-key & .secret-key properties
	//calls .Project.GetS3CredentialsForBucket.
	// The project is not retrieved from the main state because the context might not have
	// an associated state or the state could be temporary.
	AllowGettingCredentialsFromProject bool

	Project core.Project
}

type OpenBucketWithCredentialsInput

type OpenBucketWithCredentialsInput struct {
	S3Host core.Host //optional

	Provider   string
	HttpsHost  core.Host
	BucketName string

	AccessKey, SecretKey string
}

type PutObjectResponse

type PutObjectResponse struct {
	// contains filtered or unexported fields
}

func S3put

func S3put(ctx *core.Context, u core.URL, readable core.Readable) (*PutObjectResponse, error)

func (*PutObjectResponse) Equal

func (r *PutObjectResponse) Equal(ctx *core.Context, other core.Value, alreadyCompared map[uintptr]uintptr, depth int) bool

func (*PutObjectResponse) GetGoMethod

func (resp *PutObjectResponse) GetGoMethod(name string) (*core.GoFunction, bool)

func (*PutObjectResponse) IsMutable

func (r *PutObjectResponse) IsMutable() bool

func (*PutObjectResponse) PrettyPrint

func (r *PutObjectResponse) PrettyPrint(w *bufio.Writer, config *core.PrettyPrintConfig, depth int, parentIndentCount int)

func (*PutObjectResponse) Prop

func (resp *PutObjectResponse) Prop(ctx *core.Context, name string) core.Value

func (*PutObjectResponse) PropertyNames

func (*PutObjectResponse) PropertyNames(ctx *core.Context) []string

func (*PutObjectResponse) SetProp

func (*PutObjectResponse) SetProp(ctx *core.Context, name string, value core.Value) error

func (*PutObjectResponse) ToSymbolicValue

func (resp *PutObjectResponse) ToSymbolicValue(ctx *core.Context, encountered map[uintptr]symbolic.Value) (symbolic.Value, error)

type S3Client

type S3Client struct {
	// contains filtered or unexported fields
}

func (*S3Client) CopyObject

func (c *S3Client) CopyObject(ctx *core.Context, dst minio.CopyDestOptions, src minio.CopySrcOptions) (minio.UploadInfo, error)

func (*S3Client) GetBucketPolicy

func (c *S3Client) GetBucketPolicy(ctx *core.Context, bucketName string) (string, error)

func (*S3Client) GetObject

func (c *S3Client) GetObject(ctx *core.Context, bucketName, objectName string, opts minio.GetObjectOptions) (*minio.Object, error)

func (*S3Client) ListObjects

func (c *S3Client) ListObjects(ctx *core.Context, bucketName string, opts minio.ListObjectsOptions) ([]*ObjectInfo, error)

func (*S3Client) ListObjectsLive

func (c *S3Client) ListObjectsLive(ctx *core.Context, bucketName string, opts minio.ListObjectsOptions) <-chan minio.ObjectInfo

func (*S3Client) PutObject

func (c *S3Client) PutObject(ctx *core.Context, bucketName, objectName string, reader io.Reader, objectSize int64,
	opts minio.PutObjectOptions) (minio.UploadInfo, error)

func (*S3Client) PutObjectNoCtx

func (c *S3Client) PutObjectNoCtx(bucketName, objectName string, reader io.Reader, objectSize int64,
	opts minio.PutObjectOptions) (minio.UploadInfo, error)

func (*S3Client) RemoveObject

func (c *S3Client) RemoveObject(ctx *core.Context, bucketName string, objectName string, opts minio.RemoveObjectOptions) error

func (*S3Client) RemoveObjects

func (c *S3Client) RemoveObjects(ctx *core.Context, bucketName string, objectChan <-chan minio.ObjectInfo, opts minio.RemoveObjectsOptions) <-chan minio.RemoveObjectError

func (*S3Client) SetBucketPolicy

func (c *S3Client) SetBucketPolicy(ctx *core.Context, bucketName, content string) error

type S3Filesystem

type S3Filesystem struct {
	// contains filtered or unexported fields
}

func NewS3Filesystem

func NewS3Filesystem(ctx *core.Context, bucket *Bucket) *S3Filesystem

func (*S3Filesystem) Create

func (fls *S3Filesystem) Create(filename string) (billy.File, error)

func (*S3Filesystem) Join

func (fls *S3Filesystem) Join(elem ...string) string

func (*S3Filesystem) Open

func (fls *S3Filesystem) Open(filename string) (billy.File, error)

func (*S3Filesystem) OpenFile

func (fls *S3Filesystem) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)

func (*S3Filesystem) Remove

func (fls *S3Filesystem) Remove(filename string) error

func (*S3Filesystem) RemoveAllObjects

func (fls *S3Filesystem) RemoveAllObjects()

func (*S3Filesystem) Rename

func (fls *S3Filesystem) Rename(oldpath, newpath string) error

func (*S3Filesystem) Stat

func (fls *S3Filesystem) Stat(filename string) (os.FileInfo, error)

func (*S3Filesystem) WithSecondaryContext

func (fls *S3Filesystem) WithSecondaryContext(ctx *core.Context) any

func (*S3Filesystem) WithoutSecondaryContext

func (fls *S3Filesystem) WithoutSecondaryContext() any

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL