server

package
v0.0.0-...-5739f53 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2017 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VOLUMES   = 1
	DIRECTORY = 2
	FILE_LOCK = 3
	FILE_META = 4
	BLOCKS    = 5
	STASH     = 6
)
View Source
const (
	NEW_VOLUME        = 10
	NEW_DIR           = 11
	ACQUIRE_FILE_LOCK = 12
	TOUCH_FILE        = 13
	CONFIRM_BLOCK     = 14
	COMMIT_BLOCK      = 15
	REG_STASH         = 16
	RELEASE_FILE_LOCK = 17
)
View Source
const (
	STASH_GROUP = utils.ALPHA_GROUP
)

Variables

This section is empty.

Functions

func BlockDBKey

func BlockDBKey(group uint64, file []byte, index uint64) []byte

func DBKey

func DBKey(group uint64, t uint32, key []byte) []byte

func FileKey

func FileKey(volume []byte, path []byte, index uint64) []byte

func GetBlockData

func GetBlockData(txn *badger.Txn, group uint64, file []byte, index uint64) (*pb.BlockData, error)

func GetDirectory

func GetDirectory(txn *badger.Txn, group uint64, key []byte) (*pb.Directory, error)

func GetFile

func GetFile(txn *badger.Txn, group uint64, key []byte) (*pb.FileMeta, error)

func GetHostStash

func GetHostStash(txn *badger.Txn, group uint64, nodeId uint64) (*pb.HostStash, error)

func GetPeerRPC

func GetPeerRPC(addr string) pb.PCFSClient

func GetVolume

func GetVolume(txn *badger.Txn, group uint64, key []byte) (*pb.Volume, error)

func GetWriteLock

func GetWriteLock(txn *badger.Txn, group uint64, key []byte) (*pb.FileWriteLock, error)

func IdFromName

func IdFromName(name string) []byte

func RandId

func RandId() []byte

func SetBlock

func SetBlock(txn *badger.Txn, block *pb.BlockData) error

func SetDirectory

func SetDirectory(txn *badger.Txn, group uint64, directory *pb.Directory) error

func SetFile

func SetFile(txn *badger.Txn, group uint64, file *pb.FileMeta) error

func SetHostStash

func SetHostStash(txn *badger.Txn, group uint64, host *pb.HostStash) error

func SetWriteLock

func SetWriteLock(txn *badger.Txn, group uint64, lock *pb.FileWriteLock) error

Types

type FileConfig

type FileConfig struct {
	Capacity string
}

func ReadConfigFile

func ReadConfigFile(path string) FileConfig

type PCFSServer

type PCFSServer struct {
	BFTRaft       *bft.BFTRaftServer
	PendingBlocks *cache.Cache
}

func GetServer

func GetServer(bft *bft.BFTRaftServer) *PCFSServer

func (*PCFSServer) AppendToBlock

func (s *PCFSServer) AppendToBlock(ctx context.Context, req *pb.AppendToBlockRequest) (*pb.WriteResult, error)

Following RPCs are for block stash servers These servers are likely have no idea about files, directories and volumes To get file meta data, it need to consult the group members

func (*PCFSServer) CheckJoinAlphaGroup

func (s *PCFSServer) CheckJoinAlphaGroup()

func (*PCFSServer) CheckStashGroup

func (s *PCFSServer) CheckStashGroup(join bool)

func (*PCFSServer) CreateBlock

func (s *PCFSServer) CreateBlock(ctx context.Context, req *pb.CreateBlockRequest) (*pb.WriteResult, error)

func (*PCFSServer) DeleteBlock

func (s *PCFSServer) DeleteBlock(ctx context.Context, req *pb.DeleteBlockRequest) (*pb.WriteResult, error)

func (*PCFSServer) GetBlock

func (s *PCFSServer) GetBlock(ctx context.Context, req *pb.GetBlockRequest) (*pb.BlockData, error)

func (*PCFSServer) GetDirectory

func (s *PCFSServer) GetDirectory(ctx context.Context, req *pb.GetDirectoryRequest) (*pb.Directory, error)

func (*PCFSServer) GetFileMeta

func (s *PCFSServer) GetFileMeta(ctx context.Context, req *pb.GetFileRequest) (*pb.FileMeta, error)

func (*PCFSServer) GetMajorityFileMeta

func (s *PCFSServer) GetMajorityFileMeta(group uint64, file []byte) (*pb.FileMeta, error)

func (*PCFSServer) GetVolume

func (s *PCFSServer) GetVolume(ctx context.Context, req *pb.GetVolumeRequest) (*pb.Volume, error)

func (*PCFSServer) GroupMajorityResponse

func (s *PCFSServer) GroupMajorityResponse(group uint64, f func(client pb.PCFSClient) (interface{}, []byte)) interface{}

func (*PCFSServer) ListDirectory

naive implementation

func (*PCFSServer) RegisterNode

func (s *PCFSServer) RegisterNode(config FileConfig)

func (*PCFSServer) RegisterStorageContracts

func (s *PCFSServer) RegisterStorageContracts()

func (*PCFSServer) ReleaseWriteLock

func (s *PCFSServer) ReleaseWriteLock(txn *badger.Txn, group uint64, lock *pb.FileWriteLock) error

func (*PCFSServer) SetBlock

func (s *PCFSServer) SetBlock(ctx context.Context, data *pb.BlockData) (*pb.WriteResult, error)

func (*PCFSServer) SuggestBlockStash

Jump to

Keyboard shortcuts

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