proxy

package
v0.0.0-...-303e327 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: Apache-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DiskvPathTransform

func DiskvPathTransform(key string) []string

DiskvPathTransform transform key to multi-level path. eg: key(with '{namespace}-{id}') --> ~/hash(key)[0:2]/hash(key)[2:4]/key

Types

type AllocRet

type AllocRet struct {
	BidStart proto.BlobID `json:"bid_start"`
	BidEnd   proto.BlobID `json:"bid_end"`
	Vid      proto.Vid    `json:"vid"`
}

type AllocVolsArgs

type AllocVolsArgs struct {
	Fsize    uint64            `json:"fsize"`
	CodeMode codemode.CodeMode `json:"code_mode"`
	BidCount uint64            `json:"bid_count"`
	Excludes []proto.Vid       `json:"excludes"`
	Discards []proto.Vid       `json:"discards"`
}

type Allocator

type Allocator interface {
	VolumeAlloc(ctx context.Context, host string, args *AllocVolsArgs) (ret []AllocRet, err error)
	ListVolumes(ctx context.Context, host string, args *ListVolsArgs) (ret VolumeList, err error)
}

type BlobDelete

type BlobDelete struct {
	Bid proto.BlobID `json:"bid"`
	Vid proto.Vid    `json:"vid"`
}

type CacheDiskArgs

type CacheDiskArgs struct {
	DiskID proto.DiskID `json:"disk_id"`
	Flush  bool         `json:"flush,omitempty"`
}

CacheDiskArgs disk arguments.

type CacheVolumeArgs

type CacheVolumeArgs struct {
	Vid     proto.Vid `json:"vid"`
	Version uint32    `json:"version,omitempty"`
	Flush   bool      `json:"flush,omitempty"`
}

CacheVolumeArgs volume arguments.

type Cacher

type Cacher interface {
	GetCacheVolume(ctx context.Context, host string, args *CacheVolumeArgs) (*VersionVolume, error)
	GetCacheDisk(ctx context.Context, host string, args *CacheDiskArgs) (*blobnode.DiskInfo, error)
	// Erase cache in proxy memory and diskv.
	// Volume key is "volume-{vid}", and disk key is "disk-{disk_id}".
	// Notice: Erase all if key is "ALL"!
	Erase(ctx context.Context, host string, key string) error
}

Cacher interface of proxy cache.

type Client

type Client interface {
	MsgSender
	Allocator
	Cacher
}

func New

func New(cfg *Config) Client

type Config

type Config struct {
	rpc.Config
}

type DeleteArgs

type DeleteArgs struct {
	ClusterID proto.ClusterID `json:"cluster_id"`
	Blobs     []BlobDelete    `json:"blobs"`
}

type LbConfig

type LbConfig struct {
	Config

	HostRetry          int   `json:"host_retry"`
	HostSyncIntervalMs int64 `json:"host_sync_interval_ms"`
}

type LbMsgSender

type LbMsgSender interface {
	SendDeleteMsg(ctx context.Context, args *DeleteArgs) error
	SendShardRepairMsg(ctx context.Context, args *ShardRepairArgs) error
}

func NewMQLbClient

func NewMQLbClient(cfg *LbConfig, service clustermgr.APIService, clusterID proto.ClusterID) LbMsgSender

type ListVolsArgs

type ListVolsArgs struct {
	CodeMode codemode.CodeMode `json:"code_mode"`
}

type MsgSender

type MsgSender interface {
	SendDeleteMsg(ctx context.Context, host string, args *DeleteArgs) error
	SendShardRepairMsg(ctx context.Context, host string, args *ShardRepairArgs) error
}

type ShardRepairArgs

type ShardRepairArgs struct {
	ClusterID proto.ClusterID `json:"cluster_id"`
	Bid       proto.BlobID    `json:"bid"`
	Vid       proto.Vid       `json:"vid"`
	BadIdxes  []uint8         `json:"bad_idxes"`
	Reason    string          `json:"reason"`
}

type VersionVolume

type VersionVolume struct {
	clustermgr.VolumeInfo
	Version uint32 `json:"version,omitempty"`
}

VersionVolume volume with version.

func (*VersionVolume) GetVersion

func (v *VersionVolume) GetVersion() uint32

GetVersion calculate version with volume's units.

type VolumeList

type VolumeList struct {
	Vids    []proto.Vid                  `json:"vids"`
	Volumes []clustermgr.AllocVolumeInfo `json:"volumes"`
}

Jump to

Keyboard shortcuts

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