db

package
v0.0.0-...-4f3fdd5 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltManager

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

func NewBoltManager

func NewBoltManager(dbPath string) (*BoltManager, error)

func (*BoltManager) AddFile

func (m *BoltManager) AddFile(c *common.CartonFile) error

func (*BoltManager) Close

func (m *BoltManager) Close() error

func (*BoltManager) DeleteFile

func (m *BoltManager) DeleteFile(hash string) error

func (*BoltManager) GetAllFiles

func (m *BoltManager) GetAllFiles() ([]*common.CartonFile, error)

func (*BoltManager) GetFileByHash

func (m *BoltManager) GetFileByHash(hash string) (
	*common.CartonFile,
	error,
)

func (*BoltManager) GetFileByName

func (m *BoltManager) GetFileByName(name string) *common.CartonFile

func (*BoltManager) GetPwdHash

func (m *BoltManager) GetPwdHash(user string) []byte

func (*BoltManager) IsUser

func (m *BoltManager) IsUser(user string) bool

func (*BoltManager) RegisterUser

func (m *BoltManager) RegisterUser(user string, hash []byte) error

type DbManager

type DbManager interface {
	IsUser(user string) bool
	RegisterUser(user string, hash []byte) error
	GetPwdHash(user string) []byte
	AddFile(c *common.CartonFile) error
	GetAllFiles() ([]*common.CartonFile, error)
	GetFileByHash(name string) (*common.CartonFile, error)
	GetFileByName(hash string) *common.CartonFile
	DeleteFile(hash string) error
	Close() error
}

type MockDbManager

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

func NewMockDbManager

func NewMockDbManager(registrationError bool) *MockDbManager

func (*MockDbManager) AddFile

func (db *MockDbManager) AddFile(c *common.CartonFile) error

func (*MockDbManager) Close

func (db *MockDbManager) Close() error

func (*MockDbManager) DeleteFile

func (db *MockDbManager) DeleteFile(hash string) error

func (*MockDbManager) GetAllFiles

func (db *MockDbManager) GetAllFiles() ([]*common.CartonFile, error)

func (*MockDbManager) GetFileByHash

func (db *MockDbManager) GetFileByHash(hash string) (
	*common.CartonFile,
	error,
)

func (*MockDbManager) GetFileByName

func (db *MockDbManager) GetFileByName(name string) *common.CartonFile

func (*MockDbManager) GetPwdHash

func (db *MockDbManager) GetPwdHash(user string) []byte

func (*MockDbManager) IsUser

func (db *MockDbManager) IsUser(user string) bool

func (*MockDbManager) RegisterUser

func (db *MockDbManager) RegisterUser(user string, hash []byte) error

Jump to

Keyboard shortcuts

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