object_disk

package
v2.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisksConnections = xsync.NewMapOf[*ObjectStorageConnection]()
View Source
var InitCredentialsAndConnectionsMutex sync.Mutex
View Source
var SystemDisks = xsync.NewMapOf[clickhouse.Disk]()

Functions

func ConvertLocalPathToRemote

func ConvertLocalPathToRemote(diskName, localPath string) (string, error)

func CopyObject

func CopyObject(ctx context.Context, diskName string, srcSize int64, srcBucket, srcKey, dstPath string) (int64, error)

func DeleteFile

func DeleteFile(ctx context.Context, diskName, remotePath string) error

func GetFileReader

func GetFileReader(ctx context.Context, diskName, remotePath string) (io.ReadCloser, error)

func InitCredentialsAndConnections

func InitCredentialsAndConnections(ctx context.Context, ch *clickhouse.ClickHouse, cfg *config.Config, diskName string) error

func PutFile

func PutFile(ctx context.Context, diskName, remotePath string, content []byte) error

func ReadBoolText

func ReadBoolText(scanner *bufio.Scanner) (bool, error)

func ReadFileContent

func ReadFileContent(ctx context.Context, ch *clickhouse.ClickHouse, cfg *config.Config, diskName, localPath string) ([]byte, error)

func ReadInt64Text

func ReadInt64Text(scanner *bufio.Scanner) (int64, error)

func ReadIntText

func ReadIntText(scanner *bufio.Scanner) (int, error)

func WriteFileContent

func WriteFileContent(ctx context.Context, ch *clickhouse.ClickHouse, cfg *config.Config, diskName, localPath string, content []byte) error

func WriteMetadataToFile

func WriteMetadataToFile(metadata *Metadata, path string) error

Types

type Metadata

type Metadata struct {
	Version            MetadataVersion
	StorageObjectCount int
	TotalSize          int64
	StorageObjects     []StorageObject
	RefCount           int
	ReadOnly           bool
	InlineData         string
	Path               string
}

func ReadMetadataFromFile

func ReadMetadataFromFile(path string) (*Metadata, error)

func ReadMetadataFromReader

func ReadMetadataFromReader(metadataFile io.ReadCloser, path string) (*Metadata, error)

type MetadataVersion

type MetadataVersion uint32
const (
	VersionAbsolutePaths MetadataVersion = 1
	VersionRelativePath  MetadataVersion = 2
	VersionReadOnlyFlag  MetadataVersion = 3
	VersionInlineData    MetadataVersion = 4
)

origin https://github.com/ClickHouse/ClickHouse/blame/master/src/Disks/ObjectStorages/DiskObjectStorageMetadata.h#L15

type Object

type Object struct {
	Key      string
	Created  time.Time
	Deleted  time.Time
	Versions []string
	Deletes  []string
	Size     int64
}

type ObjectStorageConnection

type ObjectStorageConnection struct {
	Type         string
	S3           *storage.S3
	AzureBlob    *storage.AzureBlob
	MetadataPath string
}

func (*ObjectStorageConnection) GetRemoteBucket

func (c *ObjectStorageConnection) GetRemoteBucket() string

func (*ObjectStorageConnection) GetRemotePath

func (c *ObjectStorageConnection) GetRemotePath() string

func (*ObjectStorageConnection) GetRemoteStorage

func (c *ObjectStorageConnection) GetRemoteStorage() storage.RemoteStorage

type ObjectStorageCredentials

type ObjectStorageCredentials struct {
	Type               string // aws, gcs, azblob
	EndPoint           string
	S3AccessKey        string
	S3SecretKey        string
	S3AssumeRole       string
	S3Region           string
	S3StorageClass     string
	AzureAccountName   string
	AzureAccountKey    string
	AzureContainerName string
}

type StorageObject

type StorageObject struct {
	ObjectSize         int64
	ObjectRelativePath string
}

Jump to

Keyboard shortcuts

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