s3

package
v1.2.3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package s3 implements a non-hierarchical file store using Amazon s3. A file store uses a single bucket. Each file is an object with its UUID as the name. The file name is stored in the user-defined object metadata x-amz-meta-filename.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FS

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

func New

func New(endpoint string, secure bool, id, secret, bucket, location string) (*FS, error)

New “connects” to an s3 endpoint and creates a file store using the specified bucket. The bucket is created if it doesn't exist.

Example
package main

import (
	"dev.sum7.eu/genofire/golang-lib/web/file/s3"
)

func main() {
	s3.New("play.min.io", true, "Q3AM3UQ867SPQQA43P2F", "zuf+tfteSlswRu7BJ86wekitnifILbZam1KYY3TG", "file-store", "")
}
Output:

func (*FS) Check

func (fs *FS) Check() error

TODO: do some checking

func (*FS) Open

func (fs *FS) Open(name string) (fs.File, error)

TODO: implement

func (*FS) OpenUUID

func (fs *FS) OpenUUID(id uuid.UUID) (fs.File, error)

func (*FS) RemoveUUID

func (fs *FS) RemoveUUID(id uuid.UUID) error

func (*FS) Store

func (fs *FS) Store(id uuid.UUID, name, contentType string, data io.Reader) error

type File

type File struct {
	*minio.Object
}

func (File) Stat

func (f File) Stat() (fs.FileInfo, error)

type FileInfo

type FileInfo struct {
	minio.ObjectInfo
}

func (FileInfo) ContentType

func (fi FileInfo) ContentType() string

func (FileInfo) ID

func (fi FileInfo) ID() uuid.UUID

func (FileInfo) IsDir

func (fi FileInfo) IsDir() bool

func (FileInfo) ModTime

func (fi FileInfo) ModTime() time.Time

func (FileInfo) Mode

func (fi FileInfo) Mode() fs.FileMode

TODO: try to map s3 permissions to these, somehow

func (FileInfo) Name

func (fi FileInfo) Name() string

func (FileInfo) Size

func (fi FileInfo) Size() int64

func (FileInfo) Sys

func (fi FileInfo) Sys() interface{}

Jump to

Keyboard shortcuts

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