bucketsync

package
v0.0.0-...-6bb0f7c Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2018 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InodeHash

func InodeHash(o ObjectKey) uint64

func NewCache

func NewCache(maxEntries int) *cache

NewCache returns LRU Cache

func NewFileSystem

func NewFileSystem(config *Config) *pathfs.PathNodeFs

Types

type Cipher

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

func NewCipher

func NewCipher(password string) (*Cipher, error)

func (*Cipher) StreamReader

func (c *Cipher) StreamReader(in io.Reader, key ObjectKey) (cipher.StreamReader, error)

func (*Cipher) StreamWriter

func (c *Cipher) StreamWriter(out io.Writer, key ObjectKey) (cipher.StreamWriter, error)

type Config

type Config struct {
	Bucket        string `yaml:"bucket"`
	Region        string `yaml:"region"`
	AccessKey     string `yaml:"access_key"`
	SecretKey     string `yaml:"secret_key"`
	Password      string `yaml:"password"`
	Logging       string `yaml:"logging"`
	LogOutputPath string `yaml:"log_output_path"`
	CacheSize     int    `yaml:"cache_size"`
	ExtentSize    int64  `yaml:"extent_size"`
	Encryption    bool   `yaml:"encryption"`
	Compression   bool   `yaml:"compression"`
}

type Directory

type Directory struct {
	Key      ObjectKey            `json:"key"`
	Meta     Meta                 `json:"meta"`
	FileMeta map[string]ObjectKey `json:"children"`
	// contains filtered or unexported fields
}

func (*Directory) Save

func (o *Directory) Save() error

type Extent

type Extent struct {
	Key ObjectKey `json:"key"`
	// contains filtered or unexported fields
}

func (*Extent) CurrentKey

func (e *Extent) CurrentKey() ObjectKey

func (*Extent) Fill

func (e *Extent) Fill() error

type File

type File struct {
	Key        ObjectKey         `json:"key"`
	Meta       Meta              `json:"meta"`
	ExtentSize int64             `json:"extent_size"`
	Extent     map[int64]*Extent `json:"extent"`
	// contains filtered or unexported fields
}

func (*File) Save

func (o *File) Save() error

type FileSystem

type FileSystem struct {
	pathfs.FileSystem
	Sess *Session
	// contains filtered or unexported fields
}

func (*FileSystem) Access

func (f *FileSystem) Access(name string, mode uint32, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Chmod

func (f *FileSystem) Chmod(name string, mode uint32, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Chown

func (f *FileSystem) Chown(name string, uid uint32, gid uint32, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Create

func (f *FileSystem) Create(name string, flags uint32, mode uint32, context *fuse.Context) (nodefs.File, fuse.Status)

func (*FileSystem) GetAttr

func (f *FileSystem) GetAttr(name string, context *fuse.Context) (*fuse.Attr, fuse.Status)

func (*FileSystem) Mkdir

func (f *FileSystem) Mkdir(name string, mode uint32, context *fuse.Context) fuse.Status

func (*FileSystem) OnMount

func (f *FileSystem) OnMount(nodeFs *pathfs.PathNodeFs)

func (*FileSystem) OnUnmount

func (f *FileSystem) OnUnmount()

func (*FileSystem) Open

func (f *FileSystem) Open(name string, flags uint32, context *fuse.Context) (file nodefs.File, code fuse.Status)

func (*FileSystem) OpenDir

func (f *FileSystem) OpenDir(name string, context *fuse.Context) (stream []fuse.DirEntry, code fuse.Status)
func (f *FileSystem) Readlink(name string, context *fuse.Context) (string, fuse.Status)

func (*FileSystem) Rename

func (f *FileSystem) Rename(oldName string, newName string, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Rmdir

func (f *FileSystem) Rmdir(name string, context *fuse.Context) (code fuse.Status)

func (*FileSystem) String

func (f *FileSystem) String() string
func (f *FileSystem) Symlink(value string, linkName string, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Truncate

func (f *FileSystem) Truncate(name string, size uint64, context *fuse.Context) (code fuse.Status)
func (f *FileSystem) Unlink(name string, context *fuse.Context) (code fuse.Status)

func (*FileSystem) Utimens

func (f *FileSystem) Utimens(name string, Atime *time.Time, Mtime *time.Time, context *fuse.Context) (code fuse.Status)

type Logger

type Logger struct {
	*zap.Logger
}

func NewLogger

func NewLogger(outputPath string, debug bool) (logger *Logger, err error)

func (*Logger) Log

func (l *Logger) Log(input ...interface{})

For aws log library

func (*Logger) Write

func (l *Logger) Write(input []byte) (int, error)

Wrap standard log library

type Meta

type Meta struct {
	Size  int64     `json:"size"`
	Mode  uint32    `json:"mode"`
	UID   uint32    `json:"uid"`
	GID   uint32    `json:"gid"`
	Atime time.Time `json:"atime"`
	Ctime time.Time `json:"ctime"`
	Mtime time.Time `json:"mtime"`
}

Meta is common struct for directory, file and symlink

func NewMeta

func NewMeta(mode uint32, context *fuse.Context) Meta

type Node

type Node struct {
	Key  ObjectKey `json:"key"`
	Meta Meta      `json:"meta"`
}

Node is common part of Directory, File, and SymLink

type ObjectKey

type ObjectKey = string

ObjectKey is v4 UUID assgned to newly created object

func NewObjectKey

func NewObjectKey() ObjectKey

type OpenedFile

type OpenedFile struct {
	nodefs.File
	// contains filtered or unexported fields
}

nodefs.File interface

func NewOpenedFile

func NewOpenedFile(file *File) *OpenedFile

func (*OpenedFile) Allocate

func (f *OpenedFile) Allocate(off uint64, size uint64, mode uint32) (code fuse.Status)

func (*OpenedFile) Chmod

func (f *OpenedFile) Chmod(perms uint32) fuse.Status

func (*OpenedFile) Chown

func (f *OpenedFile) Chown(uid uint32, gid uint32) fuse.Status

func (*OpenedFile) Flush

func (f *OpenedFile) Flush() fuse.Status

func (*OpenedFile) Fsync

func (f *OpenedFile) Fsync(flags int) (code fuse.Status)

func (*OpenedFile) GetAttr

func (f *OpenedFile) GetAttr(out *fuse.Attr) fuse.Status

func (*OpenedFile) Read

func (f *OpenedFile) Read(dest []byte, off int64) (fuse.ReadResult, fuse.Status)

func (*OpenedFile) Release

func (f *OpenedFile) Release()

func (*OpenedFile) String

func (f *OpenedFile) String() string

func (*OpenedFile) Truncate

func (f *OpenedFile) Truncate(size uint64) fuse.Status

func (*OpenedFile) Utimens

func (f *OpenedFile) Utimens(atime *time.Time, mtime *time.Time) fuse.Status

func (*OpenedFile) Write

func (f *OpenedFile) Write(data []byte, off int64) (written uint32, code fuse.Status)

type ReadResult

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

func (*ReadResult) Bytes

func (r *ReadResult) Bytes(buf []byte) ([]byte, fuse.Status)

func (*ReadResult) Done

func (r *ReadResult) Done()

func (*ReadResult) Size

func (r *ReadResult) Size() int

type S3Session

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

func NewS3Session

func NewS3Session(config *Config, logger *Logger) (*S3Session, error)

func (*S3Session) Download

func (s *S3Session) Download(key ObjectKey) ([]byte, error)

func (*S3Session) DownloadWithCache

func (s *S3Session) DownloadWithCache(key ObjectKey) ([]byte, error)

func (*S3Session) IsExist

func (s *S3Session) IsExist(key ObjectKey) bool

func (*S3Session) Upload

func (s *S3Session) Upload(key ObjectKey, value io.ReadSeeker) error

func (*S3Session) UploadWithCache

func (s *S3Session) UploadWithCache(key ObjectKey, value io.ReadSeeker) error

type Session

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

func NewSession

func NewSession(config *Config) (*Session, error)

func (*Session) CreateDirectory

func (s *Session) CreateDirectory(key, parent ObjectKey, mode uint32, context *fuse.Context) *Directory

func (*Session) CreateExtent

func (s *Session) CreateExtent(size int64) *Extent

func (*Session) CreateFile

func (s *Session) CreateFile(key, parent ObjectKey, mode uint32, context *fuse.Context) *File
func (s *Session) CreateSymLink(key, parent ObjectKey, linkTo string, context *fuse.Context) *SymLink

func (*Session) KeyGen

func (s *Session) KeyGen(object []byte) ObjectKey

func (*Session) NewDirectory

func (s *Session) NewDirectory(key ObjectKey) (*Directory, error)

func (*Session) NewFile

func (s *Session) NewFile(key ObjectKey) (*File, error)

func (*Session) NewNode

func (s *Session) NewNode(key ObjectKey) (*Node, error)
func (s *Session) NewSymLink(key ObjectKey) (*SymLink, error)

func (*Session) NewTypedNode

func (s *Session) NewTypedNode(key ObjectKey) (interface{}, error)

NewNode returns Directory, File or Symlink

func (*Session) PathWalk

func (s *Session) PathWalk(relPath string) (key ObjectKey, err error)

func (*Session) RootKey

func (s *Session) RootKey() ObjectKey
type SymLink struct {
	Key    ObjectKey `json:"key"`
	Meta   Meta      `json:"meta"`
	LinkTo string    `json:"linkto"`
	// contains filtered or unexported fields
}

func (*SymLink) Save

func (o *SymLink) Save() error

Jump to

Keyboard shortcuts

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