objectserver

package
v0.0.0-...-a0bb070 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2019 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Overview

Package objectserver is a generated protocol buffer package.

It is generated from these files:

kv_service.proto

It has these top-level messages:

KVAsyncJob
ListAsyncJobsMsg
ListAsyncJobsReply
SaveAsyncJobMsg
SaveAsyncJobReply
CleanAsyncJobMsg
CleanAsyncJobReply

Index

Constants

View Source
const (
	BLOOMFILTER_ENTRIES           = float64(1 << 16)
	BLOOMFILTER_FP_RATIO          = float64(0.01)
	BLOOMFILTER_RESET_THREASHHOLD = 1 << 16
)
View Source
const (
	ASYNC_JOB_DIR_PREFIX = "async_pending"
	ASYNC_JOB_BUF_SIZE   = 256
)
View Source
const (
	KV_JOBS_PAGINATION = 1024
)

Variables

View Source
var (
	EngineNotFound          = errors.New("object engine not found")
	LockPathError           = errors.New("unable to lock path")
	PathNotDirError         = errors.New("path is not a directory")
	NotPackEngine           = errors.New("engine is not pack type")
	DriveFull               = errors.New("drive is full")
	ErrHashConfNotFound     = errors.New("unable to read hash prefix and suffix")
	ErrAsyncJobDBNotFound   = errors.New("unable to find db for async jobs")
	ErrKVAsyncJobNotSaved   = errors.New("unable to save async job")
	ErrKVAsyncJobNotClean   = errors.New("unable to clean async job")
	ErrUnknownAsyncJobMgr   = errors.New("unknown async job manager type")
	ErrFSAsyncJobMgrNotInit = errors.New("unable to create fs job mgr")
)
View Source
var (
	ReqPolicyNotFound        = "storage policy not found"
	ReqNotPackEngine         = "target engine is not pack type"
	ReqNotPbData             = "body is not protobuf data"
	ReqContentTypeMissed     = "content type not specified"
	ReqDeleteInPass          = "X-Delete-At in past"
	ReqContentTypeNotAllowed = "Content-Type is not allowed in POST"
	ReqInvalidTimestamp      = "invalid X-Timestamp header"
)

Client bad request error text

Functions

func InitServer

func InitServer(config conf.Config, flags *flag.FlagSet) (
	srv.Server, error)

func InitUpdater

func InitUpdater(cnf conf.Config, flags *flag.FlagSet) (srv.Daemon, error)

func RegisterKVServiceServer

func RegisterKVServiceServer(s *grpc.Server, srv KVServiceServer)

Types

type AsyncJob

type AsyncJob interface {
	GetMethod() string
	GetHeaders() map[string]string
	GetAccount() string
	GetContainer() string
	GetObject() string
}

type AsyncJobMgr

type AsyncJobMgr interface {
	New(vars, headers map[string]string) AsyncJob

	Save(job AsyncJob) error

	Next(device string, policy int) AsyncJob

	Finish(job AsyncJob) error
}

func NewAsyncJobMgr

func NewAsyncJobMgr(cnf conf.Config, flags *flag.FlagSet) (AsyncJobMgr, error)

type CleanAsyncJobMsg

type CleanAsyncJobMsg struct {
	Job *KVAsyncJob `protobuf:"bytes,4,opt,name=job" json:"job,omitempty"`
}

func (*CleanAsyncJobMsg) Descriptor

func (*CleanAsyncJobMsg) Descriptor() ([]byte, []int)

func (*CleanAsyncJobMsg) GetJob

func (m *CleanAsyncJobMsg) GetJob() *KVAsyncJob

func (*CleanAsyncJobMsg) ProtoMessage

func (*CleanAsyncJobMsg) ProtoMessage()

func (*CleanAsyncJobMsg) Reset

func (m *CleanAsyncJobMsg) Reset()

func (*CleanAsyncJobMsg) String

func (m *CleanAsyncJobMsg) String() string

type CleanAsyncJobReply

type CleanAsyncJobReply struct {
	Success bool `protobuf:"varint,1,opt,name=success" json:"success,omitempty"`
}

func (*CleanAsyncJobReply) Descriptor

func (*CleanAsyncJobReply) Descriptor() ([]byte, []int)

func (*CleanAsyncJobReply) GetSuccess

func (m *CleanAsyncJobReply) GetSuccess() bool

func (*CleanAsyncJobReply) ProtoMessage

func (*CleanAsyncJobReply) ProtoMessage()

func (*CleanAsyncJobReply) Reset

func (m *CleanAsyncJobReply) Reset()

func (*CleanAsyncJobReply) String

func (m *CleanAsyncJobReply) String() string

type FSAsyncJob

type FSAsyncJob struct {
	Method    string            `pickle:"op"`
	Headers   map[string]string `pickle:"headers"`
	Account   string            `pickle:"account"`
	Container string            `pickle:"container"`
	Object    string            `pickle:"obj"`
	Device    string            `pickle:"device"`
	Policy    int               `pickle:"policy"`
}

I'm afraid we can't reuse here KVAsyncJob since FSAsyncJobMgr uses another serialization framework, pickle. Cannot figure out how to ignore field in Pickle. Both Device and Policy could be ignored.

func (*FSAsyncJob) GetAccount

func (j *FSAsyncJob) GetAccount() string

func (*FSAsyncJob) GetContainer

func (j *FSAsyncJob) GetContainer() string

func (*FSAsyncJob) GetHeaders

func (j *FSAsyncJob) GetHeaders() map[string]string

func (*FSAsyncJob) GetMethod

func (j *FSAsyncJob) GetMethod() string

func (*FSAsyncJob) GetObject

func (j *FSAsyncJob) GetObject() string

type FSAsyncJobMgr

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

func NewFSAsyncJobMgr

func NewFSAsyncJobMgr(driveRoot string) (*FSAsyncJobMgr, error)

func (*FSAsyncJobMgr) Finish

func (m *FSAsyncJobMgr) Finish(job AsyncJob) error

func (*FSAsyncJobMgr) New

func (m *FSAsyncJobMgr) New(vars, headers map[string]string) AsyncJob

func (*FSAsyncJobMgr) Next

func (m *FSAsyncJobMgr) Next(device string, policy int) AsyncJob

func (*FSAsyncJobMgr) Save

func (m *FSAsyncJobMgr) Save(job AsyncJob) error

type FSStore

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

func NewFSStore

func NewFSStore(driveRoot string) *FSStore

func (*FSStore) CleanAsyncJob

func (s *FSStore) CleanAsyncJob(job *FSAsyncJob) error

func (*FSStore) ListAsyncJobs

func (s *FSStore) ListAsyncJobs(
	device string, policy int, num int) ([]*FSAsyncJob, error)

func (*FSStore) SaveAsyncJob

func (s *FSStore) SaveAsyncJob(job *FSAsyncJob) error

type KVAsyncJob

type KVAsyncJob struct {
	Method    string            `protobuf:"bytes,1,opt,name=method" json:"method,omitempty"`
	Headers   map[string]string `` /* 134-byte string literal not displayed */
	Account   string            `protobuf:"bytes,3,opt,name=account" json:"account,omitempty"`
	Container string            `protobuf:"bytes,4,opt,name=container" json:"container,omitempty"`
	Object    string            `protobuf:"bytes,5,opt,name=object" json:"object,omitempty"`
	Device    string            `protobuf:"bytes,6,opt,name=device" json:"device,omitempty"`
	Policy    int32             `protobuf:"varint,7,opt,name=policy" json:"policy,omitempty"`
}

func (*KVAsyncJob) Descriptor

func (*KVAsyncJob) Descriptor() ([]byte, []int)

func (*KVAsyncJob) GetAccount

func (m *KVAsyncJob) GetAccount() string

func (*KVAsyncJob) GetContainer

func (m *KVAsyncJob) GetContainer() string

func (*KVAsyncJob) GetDevice

func (m *KVAsyncJob) GetDevice() string

func (*KVAsyncJob) GetHeaders

func (m *KVAsyncJob) GetHeaders() map[string]string

func (*KVAsyncJob) GetMethod

func (m *KVAsyncJob) GetMethod() string

func (*KVAsyncJob) GetObject

func (m *KVAsyncJob) GetObject() string

func (*KVAsyncJob) GetPolicy

func (m *KVAsyncJob) GetPolicy() int32

func (*KVAsyncJob) ProtoMessage

func (*KVAsyncJob) ProtoMessage()

func (*KVAsyncJob) Reset

func (m *KVAsyncJob) Reset()

func (*KVAsyncJob) String

func (m *KVAsyncJob) String() string

type KVAsyncJobMgr

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

func NewKVAsyncJobMgr

func NewKVAsyncJobMgr(port int) (*KVAsyncJobMgr, error)

func (*KVAsyncJobMgr) Finish

func (m *KVAsyncJobMgr) Finish(job AsyncJob) error

func (*KVAsyncJobMgr) New

func (m *KVAsyncJobMgr) New(vars, headers map[string]string) AsyncJob

func (*KVAsyncJobMgr) Next

func (m *KVAsyncJobMgr) Next(device string, policy int) AsyncJob

func (*KVAsyncJobMgr) Save

func (m *KVAsyncJobMgr) Save(job AsyncJob) error

type KVService

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

func NewKVFSService

func NewKVFSService(fs *FSStore, kv *KVStore, rpcPort int) *KVService

func NewKVService

func NewKVService(kv *KVStore, rpcPort int) *KVService

func (*KVService) CleanAsyncJob

func (k *KVService) CleanAsyncJob(
	ctx context.Context, msg *CleanAsyncJobMsg) (*CleanAsyncJobReply, error)

func (*KVService) ListAsyncJobs

func (k *KVService) ListAsyncJobs(
	ctx context.Context, msg *ListAsyncJobsMsg) (*ListAsyncJobsReply, error)

func (*KVService) SaveAsyncJob

func (k *KVService) SaveAsyncJob(
	ctx context.Context, msg *SaveAsyncJobMsg) (*SaveAsyncJobReply, error)

type KVServiceClient

type KVServiceClient interface {
	SaveAsyncJob(ctx context.Context, in *SaveAsyncJobMsg, opts ...grpc.CallOption) (*SaveAsyncJobReply, error)
	ListAsyncJobs(ctx context.Context, in *ListAsyncJobsMsg, opts ...grpc.CallOption) (*ListAsyncJobsReply, error)
	CleanAsyncJob(ctx context.Context, in *CleanAsyncJobMsg, opts ...grpc.CallOption) (*CleanAsyncJobReply, error)
}

func NewKVServiceClient

func NewKVServiceClient(cc *grpc.ClientConn) KVServiceClient

type KVServiceServer

type KVServiceServer interface {
	SaveAsyncJob(context.Context, *SaveAsyncJobMsg) (*SaveAsyncJobReply, error)
	ListAsyncJobs(context.Context, *ListAsyncJobsMsg) (*ListAsyncJobsReply, error)
	CleanAsyncJob(context.Context, *CleanAsyncJobMsg) (*CleanAsyncJobReply, error)
}

type KVStore

type KVStore struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewKVStore

func NewKVStore(driveRoot string, ringPort int) *KVStore

func (*KVStore) CleanAsyncJob

func (s *KVStore) CleanAsyncJob(job *KVAsyncJob) error

func (*KVStore) ListAsyncJobs

func (s *KVStore) ListAsyncJobs(
	device string, policy int, num int) ([]*KVAsyncJob, error)

func (*KVStore) SaveAsyncJob

func (s *KVStore) SaveAsyncJob(job *KVAsyncJob) error

type ListAsyncJobsMsg

type ListAsyncJobsMsg struct {
	Device     string `protobuf:"bytes,1,opt,name=device" json:"device,omitempty"`
	Policy     int32  `protobuf:"varint,2,opt,name=policy" json:"policy,omitempty"`
	Pagination int32  `protobuf:"varint,3,opt,name=pagination" json:"pagination,omitempty"`
}

func (*ListAsyncJobsMsg) Descriptor

func (*ListAsyncJobsMsg) Descriptor() ([]byte, []int)

func (*ListAsyncJobsMsg) GetDevice

func (m *ListAsyncJobsMsg) GetDevice() string

func (*ListAsyncJobsMsg) GetPagination

func (m *ListAsyncJobsMsg) GetPagination() int32

func (*ListAsyncJobsMsg) GetPolicy

func (m *ListAsyncJobsMsg) GetPolicy() int32

func (*ListAsyncJobsMsg) ProtoMessage

func (*ListAsyncJobsMsg) ProtoMessage()

func (*ListAsyncJobsMsg) Reset

func (m *ListAsyncJobsMsg) Reset()

func (*ListAsyncJobsMsg) String

func (m *ListAsyncJobsMsg) String() string

type ListAsyncJobsReply

type ListAsyncJobsReply struct {
	Jobs []*KVAsyncJob `protobuf:"bytes,1,rep,name=jobs" json:"jobs,omitempty"`
}

func (*ListAsyncJobsReply) Descriptor

func (*ListAsyncJobsReply) Descriptor() ([]byte, []int)

func (*ListAsyncJobsReply) GetJobs

func (m *ListAsyncJobsReply) GetJobs() []*KVAsyncJob

func (*ListAsyncJobsReply) ProtoMessage

func (*ListAsyncJobsReply) ProtoMessage()

func (*ListAsyncJobsReply) Reset

func (m *ListAsyncJobsReply) Reset()

func (*ListAsyncJobsReply) String

func (m *ListAsyncJobsReply) String() string

type ObjectServer

type ObjectServer struct {
	http.Server
	// contains filtered or unexported fields
}

func (*ObjectServer) DeviceAcquirer

func (s *ObjectServer) DeviceAcquirer(next http.Handler) http.Handler

func (*ObjectServer) DiffReplicasHandler

func (s *ObjectServer) DiffReplicasHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) DiskUsageHandler

func (s *ObjectServer) DiskUsageHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) Finalize

func (s *ObjectServer) Finalize()

func (*ObjectServer) HealthcheckHandler

func (s *ObjectServer) HealthcheckHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ObjDeleteHandler

func (s *ObjectServer) ObjDeleteHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ObjGetHandler

func (s *ObjectServer) ObjGetHandler(w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ObjPostHandler

func (s *ObjectServer) ObjPostHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ObjPutHandler

func (s *ObjectServer) ObjPutHandler(w http.ResponseWriter, req *http.Request)

func (*ObjectServer) OptionsHandler

func (s *ObjectServer) OptionsHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ReconHandler

func (s *ObjectServer) ReconHandler(w http.ResponseWriter, req *http.Request)

func (*ObjectServer) ReplicateHandler

func (s *ObjectServer) ReplicateHandler(
	w http.ResponseWriter, req *http.Request)

func (*ObjectServer) RequestLogger

func (server *ObjectServer) RequestLogger(next http.Handler) http.Handler

func (*ObjectServer) Start

func (s *ObjectServer) Start() error

type SaveAsyncJobMsg

type SaveAsyncJobMsg struct {
	Job *KVAsyncJob `protobuf:"bytes,1,opt,name=job" json:"job,omitempty"`
}

func (*SaveAsyncJobMsg) Descriptor

func (*SaveAsyncJobMsg) Descriptor() ([]byte, []int)

func (*SaveAsyncJobMsg) GetJob

func (m *SaveAsyncJobMsg) GetJob() *KVAsyncJob

func (*SaveAsyncJobMsg) ProtoMessage

func (*SaveAsyncJobMsg) ProtoMessage()

func (*SaveAsyncJobMsg) Reset

func (m *SaveAsyncJobMsg) Reset()

func (*SaveAsyncJobMsg) String

func (m *SaveAsyncJobMsg) String() string

type SaveAsyncJobReply

type SaveAsyncJobReply struct {
	Success bool `protobuf:"varint,1,opt,name=success" json:"success,omitempty"`
}

func (*SaveAsyncJobReply) Descriptor

func (*SaveAsyncJobReply) Descriptor() ([]byte, []int)

func (*SaveAsyncJobReply) GetSuccess

func (m *SaveAsyncJobReply) GetSuccess() bool

func (*SaveAsyncJobReply) ProtoMessage

func (*SaveAsyncJobReply) ProtoMessage()

func (*SaveAsyncJobReply) Reset

func (m *SaveAsyncJobReply) Reset()

func (*SaveAsyncJobReply) String

func (m *SaveAsyncJobReply) String() string

type Updater

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

func (*Updater) Run

func (u *Updater) Run()

func (*Updater) RunForever

func (u *Updater) RunForever()

Directories

Path Synopsis
pack
Provide necessary API for object replicator Package pack is a generated protocol buffer package.
Provide necessary API for object replicator Package pack is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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