metaserver

package
v0.0.0-...-7ce57cb Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2022 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VolumeEventTypePut = iota
	VolumeEventTypeDelete
)

Variables

This section is empty.

Functions

func FromProtoEntry

func FromProtoEntry(msg *rfspb.Entry, e *Entry)

func NewVolumeClient

func NewVolumeClient(addr string) (vpb.VolumeServerClient, error)

Types

type Attr

type Attr struct {
	Mtime         time.Time   // time of last modification
	Crtime        time.Time   // time of creation (OS X only)
	Mode          os.FileMode // file mode
	Uid           uint32      // owner uid
	Gid           uint32      // group gid
	Mime          string      // mime type
	TtlSec        int32       // ttl in seconds
	UserName      string
	GroupNames    []string
	SymlinkTarget string
	Md5           []byte
	FileSize      uint64
	Rdev          uint32
	Inode         uint64
}

func (*Attr) IsDir

func (a *Attr) IsDir() bool

type Controller

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

func NewController

func NewController(ctx context.Context) *Controller

type Entry

type Entry struct {
	Name string
	Attr
	Extended map[string][]byte

	// the following is for files
	Chunks []*rfspb.FileChunk `json:"chunks,omitempty"`

	// HardLinkId      HardLinkId
	// HardLinkCounter int32
	Content []byte

	Quota int64
}

func (*Entry) CombineChunksGetContent

func (e *Entry) CombineChunksGetContent() error

func (*Entry) DecodeAttributesAndChunks

func (e *Entry) DecodeAttributesAndChunks(data []byte) error

func (*Entry) EncodeAttributesAndChunks

func (e *Entry) EncodeAttributesAndChunks() ([]byte, error)

func (*Entry) SplitToChunks

func (e *Entry) SplitToChunks(chunkSize uint64) error

func (*Entry) ToExistingProtoEntry

func (e *Entry) ToExistingProtoEntry(message *rfspb.Entry, hasContent bool) error

type EtcdStore

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

func NewEtcdStore

func NewEtcdStore(UniqueID int32) *EtcdStore

func (*EtcdStore) Close

func (es *EtcdStore) Close()

func (*EtcdStore) DeleteEntry

func (es *EtcdStore) DeleteEntry(ctx context.Context, path string) error

func (*EtcdStore) GetEntry

func (es *EtcdStore) GetEntry(ctx context.Context, path string) (*Entry, error)

func (*EtcdStore) GetVolumesStatus

func (es *EtcdStore) GetVolumesStatus() ([]*vpb.VolumeStatus, error)

func (*EtcdStore) GetVolumesStatusChan

func (es *EtcdStore) GetVolumesStatusChan() chan *VolumeUpdateEvent

func (*EtcdStore) InsertEntry

func (es *EtcdStore) InsertEntry(ctx context.Context, dir string, entry *Entry) error

func (*EtcdStore) IsLeader

func (es *EtcdStore) IsLeader() bool

func (*EtcdStore) KvGet

func (es *EtcdStore) KvGet(ctx context.Context, key string) (string, error)

func (*EtcdStore) KvPut

func (es *EtcdStore) KvPut(ctx context.Context, key, value string) error

func (*EtcdStore) ListEntries

func (es *EtcdStore) ListEntries(ctx context.Context, dir string) ([]*Entry, error)

type MetaServer

type MetaServer struct {
	Store         *EtcdStore
	UniqueId      int32
	VolumeClients map[string]vpb.VolumeServerClient // key: volumeId
}

func NewMetaServer

func NewMetaServer() (*MetaServer, error)

func (*MetaServer) AppendFile

TODO

func (*MetaServer) CreateFile

func (*MetaServer) GetFile

func (ms *MetaServer) GetFile(ctx context.Context, req *mpb.GetFileRequest) (*mpb.GetFileResponse, error)

func (*MetaServer) List

func (ms *MetaServer) List(ctx context.Context, req *mpb.ListRequest) (*mpb.ListResponse, error)

func (*MetaServer) Mkdir

func (ms *MetaServer) Mkdir(ctx context.Context, req *mpb.MkdirRequest) (*mpb.MkdirResponse, error)

func (*MetaServer) Move

func (ms *MetaServer) Move(ctx context.Context, req *mpb.MoveRequest) (*mpb.MoveResponse, error)

func (*MetaServer) Remove

func (ms *MetaServer) Remove(ctx context.Context, req *mpb.RemoveRequest) (*mpb.RemoveResponse, error)

func (*MetaServer) Stat

func (ms *MetaServer) Stat(ctx context.Context, req *mpb.StatRequest) (*mpb.StatResponse, error)

type VolumeUpdateEvent

type VolumeUpdateEvent struct {
	Type     int
	Status   *vpb.VolumeStatus
	VolumeId string
}

Jump to

Keyboard shortcuts

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