Documentation ¶
Index ¶
- Constants
- type Client
- type Conn
- func (c *Conn) Create(opType ServerOperation) ReadWriter
- func (c *Conn) Delete(file string) bool
- func (c *Conn) Destroy(rw ReadWriter, opType ServerOperation)
- func (c *Conn) Download(file string) bool
- func (c *Conn) GenerateRemoteFilename(file, backup string) string
- func (c *Conn) Init(config map[string]string) error
- func (c *Conn) Read(file string) ([]byte, bool)
- func (c *Conn) Upload(file string, fileSize int64) bool
- func (c *Conn) Write(data []byte, file string) bool
- type ReadWriter
- type Server
- type ServerOperation
- type ServerState
- type TransferStatus
Constants ¶
const ( // DefaultProfile default profile provider DefaultProfile = "default" // S3Profile profile for s3 base remote storage S3Profile = "profile" // PROVIDER provider key PROVIDER = "provider" // BUCKET bucket key BUCKET = "bucket" // PREFIX prefix key PREFIX = "prefix" // BackupPathPrefix key for backupPathPrefix BackupPathPrefix = "backupPathPrefix" // REGION region key REGION = "region" // AWS aws cloud provider AWS = "aws" // GCP gcp cloud provider GCP = "gcp" // AWSUrl aws s3 url AWSUrl = "s3Url" // AWSForcePath aws URL base path instead of subdomains AWSForcePath = "s3ForcePathStyle" // AWSSsl if ssl needs to be enabled AWSSsl = "DisableSSL" // MultiPartChunkSize is chunk size in case of multi-part upload of individual files MultiPartChunkSize = "multiPartChunkSize" )
const ( // EPOLLET defines flag for edge-triggered EPOLLET = 1 << 31 // MaxEpollEvents defines max number of events returned by epoll_wait MaxEpollEvents = 32 // MaxClient defines max number of connection a server can accept MaxClient = 10 // RecieverPort defines port number on which server should listen for new connection RecieverPort = 9000 // ReadBufferLen defines max number of bytes should be read from wire ReadBufferLen = 32 * 1024 // EPOLLTIMEOUT defines timeout for epoll_wait EPOLLTIMEOUT = 5 * 1000 // 5 second // OpBackup : backup operation OpBackup ServerOperation = 1 // OpRestore : restore operation OpRestore ServerOperation = 1 << 1 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client defines remote client connected to server
type Conn ¶
type Conn struct { // Log used for logging message Log logrus.FieldLogger // exitServer, if server connection needs to be stopped or not ExitServer bool // contains filtered or unexported fields }
Conn defines resource used for cloud related operation
func (*Conn) Create ¶
func (c *Conn) Create(opType ServerOperation) ReadWriter
Create creates a connection to cloud blob storage object/file
func (*Conn) Destroy ¶
func (c *Conn) Destroy(rw ReadWriter, opType ServerOperation)
Destroy close the connection to blob storage object object/file
func (*Conn) Download ¶
Download will perform restore operation for given file. It will create a TCP server through which client can connect and download data from cloud blob storage file
func (*Conn) GenerateRemoteFilename ¶
GenerateRemoteFilename will create a file-name specific for given backup
type ReadWriter ¶
ReadWriter is used for read/write operation on cloud blob storage file
type Server ¶
type Server struct { // Log is used for logging Log logrus.FieldLogger // OpType defines server operation type, either backup or restore OpType ServerOperation /* client link-list */ FirstClient *Client LastClient *Client // contains filtered or unexported fields }
Server defines resource used for uploading/downloading data between cloud and remote client
func (*Server) GetReadWriter ¶
func (s *Server) GetReadWriter(bwriter *blob.Writer, breader *blob.Reader, opType ServerOperation) (ReadWriter, error)
GetReadWriter will return interface for cloud blob storage file operation
type ServerOperation ¶
type ServerOperation int
ServerOperation is used to define server operation We are supporting two operation :
- Backup
- Restore
type ServerState ¶
type ServerState struct {
// contains filtered or unexported fields
}
ServerState defines resource used for Server state
type TransferStatus ¶
type TransferStatus string
TransferStatus represents upload/download status of client/server
const ( // TransferStatusInit : transfer is initialized TransferStatusInit TransferStatus = "init" // TransferStatusDone : transfer is completed TransferStatusDone TransferStatus = "done" // TransferStatusFailed : transfer failed TransferStatusFailed TransferStatus = "failed" )