database

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

dupers todo

Index

Constants

View Source
const (
	FileMode fs.FileMode = 0600
)

Variables

View Source
var (
	ErrNoBucket  = errors.New("bucket does not exist")
	ErrDBClean   = errors.New("database had nothing to clean")
	ErrDBCompact = errors.New("database compression has not reduced the size")
)

Functions

func Backup

func Backup() (name string, written int64, err error)

Backup makes a copy of the database to the named location.

func Buckets

func Buckets() (names []string, err error)

Buckets lists all the stored bucket names in the database.

func Clean

func Clean(quiet bool) error

Clean the stale items from all database buckets. Stale items are file pointers that no longer exist on the host file system.

func Compact

func Compact() error

Compact the database by reclaiming space.

func DB

func DB() (string, error)

DB returns the absolute path of the Bolt database.

func Info

func Info() string

Info returns a printout of the buckets and their statistics.

func IsEmpty

func IsEmpty() (bool, error)

IsEmpty returns true if the database has no buckets.

func RM

func RM(name string) error

RM removes the named bucket from the database.

func Seek

func Seek(hash [32]byte, bucket string) (finds []string, records int, err error)

Seek searches a bucket for an exact SHA256 hash match.

Types

type Filepath

type Filepath string

type Matches

type Matches map[Filepath]string

func Compare

func Compare(s string, buckets []string) (*Matches, error)

Compare finds exact matches of the string contained within the stored filenames and paths.

func CompareBase

func CompareBase(s string, buckets []string) (*Matches, error)

CompareBase finds exact matches of the string contained within the stored filenames.

func CompareBaseNoCase

func CompareBaseNoCase(s string, buckets []string) (*Matches, error)

CompareBaseNoCase finds case insensitive matches of the string contained within the stored filenames.

func CompareNoCase

func CompareNoCase(s string, buckets []string) (*Matches, error)

CompareNoCase finds case insensitive matches of the string contained within the stored filenames and paths.

Jump to

Keyboard shortcuts

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