oss

package
v0.0.0-...-04d6450 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package oss is used to implement the AliCloud-Object-Storage-Service storage medium for the underlying data and indexes.

Index

Constants

View Source
const MaxKeySize = 1000

Variables

This section is empty.

Functions

func CreateBucket

func CreateBucket(client *oss.Client, bucketName string) error

func DefaultClient

func DefaultClient() (*oss.Client, error)

func DeleteObject

func DeleteObject(client *oss.Client, bucketName, object string) error

func DeleteObjects

func DeleteObjects(client *oss.Client, bucketName string, objects []string) error

func GetBucket

func GetBucket(client *oss.Client, bucketName string) (*oss.Bucket, error)

func GetObject

func GetObject(
	client *oss.Client,
	bucketName, path string,
	minimumConcurrencyLoadSize int,
) ([]byte, error)

func GetObjectConcurrency

func GetObjectConcurrency(bucket *oss.Bucket, size int, path string) ([]byte, error)

func GetObjectOrdinary

func GetObjectOrdinary(bucket *oss.Bucket, path string) ([]byte, error)

func IsBucketExist

func IsBucketExist(client *oss.Client, bucketName string) (bool, error)

func ListObjects

func ListObjects(
	client *oss.Client,
	bucketName, prefix string,
) ([]oss.ObjectProperties, error)

func NewClient

func NewClient(endpoint, accessKeyID, secretAccessKey string) (*oss.Client, error)

func OssPath

func OssPath(index string) string

func PutObject

func PutObject(client *oss.Client, bucketName, path string, buf *bytes.Buffer) error

Types

type OssDirectory

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

func NewOssDirectory

func NewOssDirectory(
	endpoint, bucket, accessKeyID, secretAccessKey, index, cacheDir string,
	minimumConcurrencyLoadSize int,
) *OssDirectory

func (*OssDirectory) List

func (d *OssDirectory) List(kind string) ([]uint64, error)

func (*OssDirectory) Load

func (d *OssDirectory) Load(
	kind string,
	id uint64,
) (ret *segment.Data, closer io.Closer, err error)

func (*OssDirectory) Lock

func (d *OssDirectory) Lock() error

Lock ensures this process has exclusive access to write in this directory. We plan to restrict an OssDirectory to be accessed by at most one process at the same time through the first-level shard strategy (shard).

func (*OssDirectory) Persist

func (d *OssDirectory) Persist(
	kind string,
	id uint64,
	w index.WriterTo,
	closeCh chan struct{},
) error

func (*OssDirectory) Remove

func (d *OssDirectory) Remove(kind string, id uint64) error

func (*OssDirectory) Setup

func (d *OssDirectory) Setup(readOnly bool) error

func (*OssDirectory) Stats

func (d *OssDirectory) Stats() (numFilesOnDisk, numBytesUsedDisk uint64)

func (*OssDirectory) Sync

func (d *OssDirectory) Sync() error

func (*OssDirectory) Unlock

func (d *OssDirectory) Unlock() error

Unlock releases the lock held on this directory. We plan to restrict an OssDirectory to be accessed by at most one process at the same time through the first-level shard strategy (shard).

Jump to

Keyboard shortcuts

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