volume

package
v0.0.0-...-f66ea8c Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: AGPL-3.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitVolumeID

func SplitVolumeID(id string) (uint64, needle.Id, error)

Types

type FilePool

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

func NewFilePool

func NewFilePool(filePath string) *FilePool

func (*FilePool) Close

func (fp *FilePool) Close() error

func (*FilePool) Get

func (fp *FilePool) Get() *os.File

func (*FilePool) Put

func (fp *FilePool) Put(file *os.File)

type NumberFile

type NumberFile struct {
	Path string
	// contains filtered or unexported fields
}

func NewNumberFile

func NewNumberFile(path string) *NumberFile

func (*NumberFile) Add

func (nf *NumberFile) Add(delta uint64) (uint64, error)

func (*NumberFile) ReadNumber

func (nf *NumberFile) ReadNumber() (uint64, error)

func (*NumberFile) WriteMax

func (nf *NumberFile) WriteMax(num uint64) (uint64, error)

func (*NumberFile) WriteNumber

func (nf *NumberFile) WriteNumber(num uint64) error

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithLocalIP

func WithLocalIP(localIP string) Option

type Server

type Server struct {
	volume_pb.UnimplementedVolumeServiceServer
	// contains filtered or unexported fields
}

func New

func New(dir, master string, logger log.Logger, creator needle.StoreCreator, opts ...Option) *Server

func (*Server) Close

func (s *Server) Close() error

func (*Server) CreateVolume

func (s *Server) CreateVolume() (*Volume, error)

func (*Server) DeleteChunk

func (s *Server) DeleteChunk(ctx context.Context, in *volume_pb.ChunkID) (*emptypb.Empty, error)

func (*Server) GetChunk

func (*Server) PutChunk

func (s *Server) PutChunk(stream volume_pb.VolumeService_PutChunkServer) error

func (*Server) Run

func (s *Server) Run(port int) error

func (*Server) SendHeartbeat

func (s *Server) SendHeartbeat()

type Volume

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

func NewVolume

func NewVolume(dir string, id uint64, creator needle.StoreCreator) (*Volume, error)

func (*Volume) Close

func (v *Volume) Close() error

func (*Volume) Delete

func (v *Volume) Delete(id needle.Id) error

func (*Volume) Magic

func (v *Volume) Magic() []byte

func (*Volume) Read

func (v *Volume) Read(id needle.Id, writer io.Writer) error

func (*Volume) Size

func (v *Volume) Size() uint64

func (*Volume) Write

func (v *Volume) Write(reader io.Reader) (string, error)

func (*Volume) WriteMagic

func (v *Volume) WriteMagic(magic []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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