clouduploader

package
v1.12.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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) Delete

func (c *Conn) Delete(file string) bool

Delete will delete file from cloud blob storage

func (*Conn) Destroy

func (c *Conn) Destroy(rw ReadWriter, opType ServerOperation)

Destroy close the connection to blob storage object object/file

func (*Conn) Download

func (c *Conn) Download(file string) bool

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

func (c *Conn) GenerateRemoteFilename(file, backup string) string

GenerateRemoteFilename will create a file-name specific for given backup

func (*Conn) Init

func (c *Conn) Init(config map[string]string) error

Init initialize connection to cloud blob storage

func (*Conn) Read

func (c *Conn) Read(file string) ([]byte, bool)

Read will return content of file from cloud blob storage

func (*Conn) Upload

func (c *Conn) Upload(file string, fileSize int64) bool

Upload will perform upload operation for given file. It will create a TCP server through which client can connect and upload data to cloud blob storage file

func (*Conn) Write

func (c *Conn) Write(data []byte, file string) bool

Write will write data to cloud blob storage file

type ReadWriter

type ReadWriter unsafe.Pointer

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

func (*Server) RecvData

func (s *Server) RecvData(c *Client) (int, error)

RecvData receives data from client and store into client's buffer

func (*Server) Run

func (s *Server) Run(opType ServerOperation) error

Run will start TCP server

func (*Server) SendData

func (s *Server) SendData(c *Client, dataLen int) error

SendData send data(stored in client's buffer) to given client

type ServerOperation

type ServerOperation int

ServerOperation is used to define server operation We are supporting two operation :

  1. Backup
  2. 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"
)

Jump to

Keyboard shortcuts

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