daobackup

package module
v0.0.0-...-cbd2392 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2025 License: ISC Imports: 20 Imported by: 0

README

daobackup

Deduplicated append-only backup

Documentation

Index

Constants

View Source
const (
	DAOBackup_PutBlob_FullMethodName   = "/daobackup.DAOBackup/PutBlob"
	DAOBackup_CheckBlob_FullMethodName = "/daobackup.DAOBackup/CheckBlob"
	DAOBackup_GetBlob_FullMethodName   = "/daobackup.DAOBackup/GetBlob"
)
View Source
const (
	MinChunkSize = 512 * 1024      // 512 KB
	MaxChunkSize = 8 * 1024 * 1024 // 8 MB
)

Variables

View Source
var (
	FileType_name = map[int32]string{
		0: "NormalFile",
		1: "Directory",
		2: "SymbolicLink",
		3: "HardLink",
	}
	FileType_value = map[string]int32{
		"NormalFile":   0,
		"Directory":    1,
		"SymbolicLink": 2,
		"HardLink":     3,
	}
)

Enum value maps for FileType.

View Source
var DAOBackup_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "daobackup.DAOBackup",
	HandlerType: (*DAOBackupServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PutBlob",
			Handler:    _DAOBackup_PutBlob_Handler,
		},
		{
			MethodName: "CheckBlob",
			Handler:    _DAOBackup_CheckBlob_Handler,
		},
		{
			MethodName: "GetBlob",
			Handler:    _DAOBackup_GetBlob_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "services.proto",
}

DAOBackup_ServiceDesc is the grpc.ServiceDesc for DAOBackup service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_services_proto protoreflect.FileDescriptor

Functions

func ChunkDir

func ChunkDir(dirpath string) func(func(ChunkHash, ErrorBytes) bool)

func ChunkFile

func ChunkFile(path string) func(func(ChunkHash, ErrorBytes) bool)

func IsValidHash

func IsValidHash(hashstring string) bool

func NewChunker

func NewChunker(rd io.Reader) *chunker.Chunker

func RegisterDAOBackupServer

func RegisterDAOBackupServer(s grpc.ServiceRegistrar, srv DAOBackupServer)

Types

type BackupClient

type BackupClient struct {
}

func (BackupClient) Backup

func (b BackupClient) Backup(root string) (err error)

type BackupRoot

type BackupRoot struct {
	Previous      []byte                 `protobuf:"bytes,1,opt,name=previous,proto3" json:"previous,omitempty"`
	Path          string                 `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
	Timestamp     *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	RootDirectory []byte                 `protobuf:"bytes,4,opt,name=root_directory,json=rootDirectory,proto3" json:"root_directory,omitempty"`
	// contains filtered or unexported fields
}

func (*BackupRoot) Descriptor deprecated

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

Deprecated: Use BackupRoot.ProtoReflect.Descriptor instead.

func (*BackupRoot) GetPath

func (x *BackupRoot) GetPath() string

func (*BackupRoot) GetPrevious

func (x *BackupRoot) GetPrevious() []byte

func (*BackupRoot) GetRootDirectory

func (x *BackupRoot) GetRootDirectory() []byte

func (*BackupRoot) GetTimestamp

func (x *BackupRoot) GetTimestamp() *timestamppb.Timestamp

func (*BackupRoot) ProtoMessage

func (*BackupRoot) ProtoMessage()

func (*BackupRoot) ProtoReflect

func (x *BackupRoot) ProtoReflect() protoreflect.Message

func (*BackupRoot) Reset

func (x *BackupRoot) Reset()

func (*BackupRoot) String

func (x *BackupRoot) String() string

type BasicFilesystemServer

type BasicFilesystemServer struct {
	Root          string
	VerifyOnRead  bool
	VerifyOnWrite bool
}

func (*BasicFilesystemServer) CheckBlob

func (server *BasicFilesystemServer) CheckBlob(c context.Context, chunkhash *Hash) (*RPCStatus, error)

func (*BasicFilesystemServer) GetBlob

func (server *BasicFilesystemServer) GetBlob(c context.Context, chunkhash *Hash) (*HashedBlob, error)

func (*BasicFilesystemServer) PutBlob

func (server *BasicFilesystemServer) PutBlob(c context.Context, hashedblob *HashedBlob) (*RPCStatus, error)

type ChunkHash

type ChunkHash [sha256.Size]byte

func ChunkHashFromBytes

func ChunkHashFromBytes(h []byte) ChunkHash

func HashChunk

func HashChunk(chunk []byte) (hash ChunkHash)

func ParseChunkHash

func ParseChunkHash(hashstring string) (h ChunkHash, err error)

func (ChunkHash) Bytes

func (h ChunkHash) Bytes() []byte

func (ChunkHash) String

func (h ChunkHash) String() string

func (ChunkHash) Verify

func (h ChunkHash) Verify(blob []byte) bool

type ChunkMeta

type ChunkMeta struct {
	Offset uint64 `protobuf:"varint,1,opt,name=offset,proto3" json:"offset,omitempty"`
	Size   uint64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	Hash   []byte `protobuf:"bytes,3,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*ChunkMeta) Descriptor deprecated

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

Deprecated: Use ChunkMeta.ProtoReflect.Descriptor instead.

func (*ChunkMeta) GetHash

func (x *ChunkMeta) GetHash() []byte

func (*ChunkMeta) GetOffset

func (x *ChunkMeta) GetOffset() uint64

func (*ChunkMeta) GetSize

func (x *ChunkMeta) GetSize() uint64

func (*ChunkMeta) ProtoMessage

func (*ChunkMeta) ProtoMessage()

func (*ChunkMeta) ProtoReflect

func (x *ChunkMeta) ProtoReflect() protoreflect.Message

func (*ChunkMeta) Reset

func (x *ChunkMeta) Reset()

func (*ChunkMeta) String

func (x *ChunkMeta) String() string

type DAOBackupClient

type DAOBackupClient interface {
	PutBlob(ctx context.Context, in *HashedBlob, opts ...grpc.CallOption) (*RPCStatus, error)
	CheckBlob(ctx context.Context, in *Hash, opts ...grpc.CallOption) (*RPCStatus, error)
	GetBlob(ctx context.Context, in *Hash, opts ...grpc.CallOption) (*HashedBlob, error)
}

DAOBackupClient is the client API for DAOBackup service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewDAOBackupClient

func NewDAOBackupClient(cc grpc.ClientConnInterface) DAOBackupClient

type DAOBackupServer

type DAOBackupServer interface {
	PutBlob(context.Context, *HashedBlob) (*RPCStatus, error)
	CheckBlob(context.Context, *Hash) (*RPCStatus, error)
	GetBlob(context.Context, *Hash) (*HashedBlob, error)
	// contains filtered or unexported methods
}

DAOBackupServer is the server API for DAOBackup service. All implementations must embed UnimplementedDAOBackupServer for forward compatibility.

type ErrorBytes

type ErrorBytes struct {
	Error error
	Bytes []byte
}

type FileMeta

type FileMeta struct {
	Type             FileType               `protobuf:"varint,1,opt,name=type,proto3,enum=daobackup.FileType" json:"type,omitempty"`
	Hash             []byte                 `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	Size             uint64                 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
	Name             string                 `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	Owner            string                 `protobuf:"bytes,5,opt,name=owner,proto3" json:"owner,omitempty"`
	Group            string                 `protobuf:"bytes,6,opt,name=group,proto3" json:"group,omitempty"`
	Mode             uint32                 `protobuf:"varint,7,opt,name=mode,proto3" json:"mode,omitempty"`
	ModificationTime *timestamppb.Timestamp `protobuf:"bytes,8,opt,name=modification_time,json=modificationTime,proto3" json:"modification_time,omitempty"`
	CreationTime     *timestamppb.Timestamp `protobuf:"bytes,9,opt,name=creation_time,json=creationTime,proto3" json:"creation_time,omitempty"`
	Chunks           []*ChunkMeta           `protobuf:"bytes,10,rep,name=chunks,proto3" json:"chunks,omitempty"`
	DirectoryEntries map[string][]byte      `` /* 184-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*FileMeta) Descriptor deprecated

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

Deprecated: Use FileMeta.ProtoReflect.Descriptor instead.

func (*FileMeta) GetChunks

func (x *FileMeta) GetChunks() []*ChunkMeta

func (*FileMeta) GetCreationTime

func (x *FileMeta) GetCreationTime() *timestamppb.Timestamp

func (*FileMeta) GetDirectoryEntries

func (x *FileMeta) GetDirectoryEntries() map[string][]byte

func (*FileMeta) GetGroup

func (x *FileMeta) GetGroup() string

func (*FileMeta) GetHash

func (x *FileMeta) GetHash() []byte

func (*FileMeta) GetMode

func (x *FileMeta) GetMode() uint32

func (*FileMeta) GetModificationTime

func (x *FileMeta) GetModificationTime() *timestamppb.Timestamp

func (*FileMeta) GetName

func (x *FileMeta) GetName() string

func (*FileMeta) GetOwner

func (x *FileMeta) GetOwner() string

func (*FileMeta) GetSize

func (x *FileMeta) GetSize() uint64

func (*FileMeta) GetType

func (x *FileMeta) GetType() FileType

func (*FileMeta) ProtoMessage

func (*FileMeta) ProtoMessage()

func (*FileMeta) ProtoReflect

func (x *FileMeta) ProtoReflect() protoreflect.Message

func (*FileMeta) Reset

func (x *FileMeta) Reset()

func (*FileMeta) String

func (x *FileMeta) String() string

type FileType

type FileType int32
const (
	FileType_NormalFile   FileType = 0
	FileType_Directory    FileType = 1
	FileType_SymbolicLink FileType = 2
	FileType_HardLink     FileType = 3
)

func (FileType) Descriptor

func (FileType) Descriptor() protoreflect.EnumDescriptor

func (FileType) Enum

func (x FileType) Enum() *FileType

func (FileType) EnumDescriptor deprecated

func (FileType) EnumDescriptor() ([]byte, []int)

Deprecated: Use FileType.Descriptor instead.

func (FileType) Number

func (x FileType) Number() protoreflect.EnumNumber

func (FileType) String

func (x FileType) String() string

func (FileType) Type

type Hash

type Hash struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// contains filtered or unexported fields
}

func (*Hash) Descriptor deprecated

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

Deprecated: Use Hash.ProtoReflect.Descriptor instead.

func (*Hash) GetHash

func (x *Hash) GetHash() []byte

func (*Hash) ProtoMessage

func (*Hash) ProtoMessage()

func (*Hash) ProtoReflect

func (x *Hash) ProtoReflect() protoreflect.Message

func (*Hash) Reset

func (x *Hash) Reset()

func (*Hash) String

func (x *Hash) String() string

type HashedBlob

type HashedBlob struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	Blob []byte `protobuf:"bytes,2,opt,name=blob,proto3" json:"blob,omitempty"`
	// contains filtered or unexported fields
}

func (*HashedBlob) Descriptor deprecated

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

Deprecated: Use HashedBlob.ProtoReflect.Descriptor instead.

func (*HashedBlob) GetBlob

func (x *HashedBlob) GetBlob() []byte

func (*HashedBlob) GetHash

func (x *HashedBlob) GetHash() []byte

func (*HashedBlob) ProtoMessage

func (*HashedBlob) ProtoMessage()

func (*HashedBlob) ProtoReflect

func (x *HashedBlob) ProtoReflect() protoreflect.Message

func (*HashedBlob) Reset

func (x *HashedBlob) Reset()

func (*HashedBlob) String

func (x *HashedBlob) String() string

type RPCStatus

type RPCStatus struct {
	Succes  bool   `protobuf:"varint,1,opt,name=succes,proto3" json:"succes,omitempty"`
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// contains filtered or unexported fields
}

func (*RPCStatus) Descriptor deprecated

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

Deprecated: Use RPCStatus.ProtoReflect.Descriptor instead.

func (*RPCStatus) GetMessage

func (x *RPCStatus) GetMessage() string

func (*RPCStatus) GetSucces

func (x *RPCStatus) GetSucces() bool

func (*RPCStatus) ProtoMessage

func (*RPCStatus) ProtoMessage()

func (*RPCStatus) ProtoReflect

func (x *RPCStatus) ProtoReflect() protoreflect.Message

func (*RPCStatus) Reset

func (x *RPCStatus) Reset()

func (*RPCStatus) String

func (x *RPCStatus) String() string

type UnimplementedDAOBackupServer

type UnimplementedDAOBackupServer struct{}

UnimplementedDAOBackupServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedDAOBackupServer) CheckBlob

func (UnimplementedDAOBackupServer) GetBlob

func (UnimplementedDAOBackupServer) PutBlob

type UnsafeDAOBackupServer

type UnsafeDAOBackupServer interface {
	// contains filtered or unexported methods
}

UnsafeDAOBackupServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to DAOBackupServer will result in compilation errors.

Directories

Path Synopsis
bin
daobackup command
cmd
daobackup command
daobackupd command

Jump to

Keyboard shortcuts

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