Documentation ¶
Overview ¶
The TeoS3 package contains Golang functions that make it easy to use S3 storage as a key-value database. This package uses [minio-go](https://github.com/minio/minio-go) S3 client.
Index ¶
- Constants
- Variables
- func Copy(accessKey, secretKey, endpoint, bucket string, args []string, secures ...bool) (err error)
- type CopyOptions
- type DelObjectOptions
- type DelOptions
- type GetInfoOptions
- type GetObjectOptions
- type GetOptions
- type ListObjectsOptions
- type ListOptions
- type MapData
- type SetObjectOptions
- type SetOptions
- type StatObjectOptions
- type TeoS3
- func (m *TeoS3) Copy(source, destination string, options ...*CopyOptions) (err error)
- func (m *TeoS3) Del(key string, options ...*DelOptions) (err error)
- func (m *TeoS3) Get(key string, options ...*GetOptions) (data []byte, err error)
- func (m *TeoS3) GetInfo(key string, options ...*GetInfoOptions) (minio.ObjectInfo, error)
- func (m *TeoS3) GetObject(key string, options ...*GetOptions) (*minio.Object, error)
- func (m *TeoS3) List(prefix string, options ...*ListOptions) (keys chan string)
- func (m *TeoS3) ListAr(prefix string, options ...*ListOptions) (list []string)
- func (m *TeoS3) ListBody(prefix string, options ...*ListOptions) (mapDataChan chan MapData)
- func (m *TeoS3) ListBodyAr(prefix string, options ...*ListOptions) (listBody []MapData)
- func (m *TeoS3) ListLen(prefix string, options ...*ListOptions) int
- func (m *TeoS3) Move(source, destination string, options ...*CopyOptions) (err error)
- func (m *TeoS3) NewDelOptions() *DelOptions
- func (m *TeoS3) NewGetOptions() *GetOptions
- func (m *TeoS3) NewGetStatOptions() *GetInfoOptions
- func (m *TeoS3) NewListOptions() *ListOptions
- func (m *TeoS3) NewSetOptions() *SetOptions
- func (m *TeoS3) Set(key string, data []byte, options ...*SetOptions) error
- func (m *TeoS3) SetContext(ctx context.Context) *TeoS3
- func (m *TeoS3) SetObject(key string, reader io.Reader, objectSize int64, options ...*SetOptions) (err error)
Constants ¶
const Version = "0.1.2"
Variables ¶
var ErrDestinationObjectAlreadyExists = errors.New(
"destination object already exists",
)
Functions ¶
Types ¶
type CopyOptions ¶ added in v0.1.2
CopyOptions contains context.Context for Copy or Move requests.
type DelObjectOptions ¶ added in v0.1.0
type DelObjectOptions minio.RemoveObjectOptions
type DelOptions ¶ added in v0.1.0
type DelOptions struct { context.Context DelObjectOptions }
DelOptions contains context.Context and options for Remove requests.
type GetInfoOptions ¶ added in v0.1.2
type GetInfoOptions struct { context.Context StatObjectOptions }
GetInfoOptions contains context.Context and options are used to specify additional headers or options during GET Object Satat requests.
type GetObjectOptions ¶ added in v0.1.0
type GetObjectOptions minio.GetObjectOptions
type GetOptions ¶ added in v0.1.0
type GetOptions struct { context.Context GetObjectOptions }
GetOptions contains context.Context and options are used to specify additional headers or options during GET requests.
type ListObjectsOptions ¶ added in v0.1.0
type ListObjectsOptions minio.ListObjectsOptions
type ListOptions ¶ added in v0.1.0
type ListOptions struct { context.Context ListObjectsOptions }
ListOptions contains context.Context and options for List requests.
func (*ListOptions) SetMaxKeys ¶ added in v0.1.0
func (l *ListOptions) SetMaxKeys(maxKeys int) *ListOptions
SetMaxKeys sets MaxKeys list options value
func (*ListOptions) SetStartAfter ¶ added in v0.1.0
func (l *ListOptions) SetStartAfter(startAfter string) *ListOptions
SetStartAfter sets StartAfter list options value
type SetObjectOptions ¶ added in v0.1.0
type SetObjectOptions minio.PutObjectOptions
type SetOptions ¶ added in v0.1.0
type SetOptions struct { context.Context SetObjectOptions }
SetOptions contains context.Context and options specified by user for Set requests
type StatObjectOptions ¶ added in v0.1.2
type StatObjectOptions minio.StatObjectOptions
type TeoS3 ¶
type TeoS3 struct {
// contains filtered or unexported fields
}
TeoS3 objects data and methods receiver
func Connect ¶
func Connect(accessKey, secretKey, endpoint string, secure bool, buckets ...string) (teos3 *TeoS3, err error)
Connect creates new cinnwction to S3 storage using accessKey, secretKey, endpoint, secure flag and bucket (if omitted then default 'teos3' buckets name used). The enpoind argument must be specified without http/https prefix(just domain and path), and the secure argument defines HTTPS if true or HTTP if false.
func (*TeoS3) Copy ¶ added in v0.1.2
func (m *TeoS3) Copy(source, destination string, options ...*CopyOptions) ( err error)
Copy copys source object to destination object
func (*TeoS3) Del ¶ added in v0.1.0
func (m *TeoS3) Del(key string, options ...*DelOptions) (err error)
Del remove key from map by key. The options parameter may be omitted and than default DelObjectOptions with context.Background and empty minio.RemoveObjectOptions used.
func (*TeoS3) Get ¶ added in v0.1.0
func (m *TeoS3) Get(key string, options ...*GetOptions) ( data []byte, err error)
Get map data by key. The options parameter may be omitted and than default GetObjectOptions with context.Background and empty minio.SetObjectOptions used.
func (*TeoS3) GetInfo ¶ added in v0.1.2
func (m *TeoS3) GetInfo(key string, options ...*GetInfoOptions) ( minio.ObjectInfo, error)
GetInfo fetchs metadata of an object by key.
func (*TeoS3) GetObject ¶ added in v0.1.0
func (m *TeoS3) GetObject(key string, options ...*GetOptions) ( *minio.Object, error)
GetObject gets map object by key. The options parameter may be omitted and than default GetObjectOptions with context.Background and empty minio. SetObjectOptions used. Returned object must be cloused with obj.Close() after use.
func (*TeoS3) List ¶ added in v0.1.0
func (m *TeoS3) List(prefix string, options ...*ListOptions) (keys chan string)
List gets list of map keys by prefix. The options parameter may be omitted and than default ListObjectsOptions with context.Background and empty minio.ListObjectsOptions used. The Prefix parameter of the ListObjectsOptions will be always overwritten with the prefix functions argument (so it may be empty).
func (*TeoS3) ListAr ¶ added in v0.1.0
func (m *TeoS3) ListAr(prefix string, options ...*ListOptions) ( list []string)
ListAr gets string array of map keys by prefix.
func (*TeoS3) ListBody ¶ added in v0.1.0
func (m *TeoS3) ListBody(prefix string, options ...*ListOptions) ( mapDataChan chan MapData)
ListBody gets all keys and values in MapData struct by prefix asynchronously.
func (*TeoS3) ListBodyAr ¶ added in v0.1.0
func (m *TeoS3) ListBodyAr(prefix string, options ...*ListOptions) ( listBody []MapData)
ListBodyAr gets MapData array with all keys and values by prefix.
func (*TeoS3) ListLen ¶ added in v0.1.0
func (m *TeoS3) ListLen(prefix string, options ...*ListOptions) int
ListLen returns the number of records in the list by prefix and options.
func (*TeoS3) Move ¶ added in v0.1.2
func (m *TeoS3) Move(source, destination string, options ...*CopyOptions) ( err error)
Move movess source object to destination object
func (*TeoS3) NewDelOptions ¶ added in v0.1.0
func (m *TeoS3) NewDelOptions() *DelOptions
NewDelOptions creates a new DelOptions object
func (*TeoS3) NewGetOptions ¶ added in v0.1.0
func (m *TeoS3) NewGetOptions() *GetOptions
NewGetOptions creates a new GetOptions object
func (*TeoS3) NewGetStatOptions ¶ added in v0.1.2
func (m *TeoS3) NewGetStatOptions() *GetInfoOptions
NewGetStatOptions creates a new GetStatOptions object
func (*TeoS3) NewListOptions ¶ added in v0.1.0
func (m *TeoS3) NewListOptions() *ListOptions
NewListOptions creates a new ListOptions object
func (*TeoS3) NewSetOptions ¶ added in v0.1.0
func (m *TeoS3) NewSetOptions() *SetOptions
NewSetOptions creates a new GetOptions object
func (*TeoS3) Set ¶ added in v0.1.0
func (m *TeoS3) Set(key string, data []byte, options ...*SetOptions) error
Set sets data to map by key. The options parameter may be omitted and than default SetObjectOptions with context.Background and empty minio.PutObjectOptions used.
func (*TeoS3) SetContext ¶ added in v0.1.0
SetContext sets context which will be used in all TeS3 operations if another context does not send in function call options argument.
func (*TeoS3) SetObject ¶ added in v0.1.0
func (m *TeoS3) SetObject(key string, reader io.Reader, objectSize int64, options ...*SetOptions) (err error)
SetObject sets object to map by key. The options parameter may be omitted and than default SetObjectOptions with context.Background and empty minio.PutObjectOptions used.
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
s3cp
The s3cp application copy file to/from S3 storage.
|
The s3cp application copy file to/from S3 storage. |
examples
|
|
keyval
TeoS3 `keyval` example.
|
TeoS3 `keyval` example. |
keyval-opts
TeoS3 `keyval-opt` example.
|
TeoS3 `keyval-opt` example. |
smpl
This application used teoS3 package which contains Go functions to rasy use S3 storage as Key Value Database.
|
This application used teoS3 package which contains Go functions to rasy use S3 storage as Key Value Database. |