scanner

package
v0.3.4 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 26 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config added in v0.3.4

type Config struct {
	BaseDirectory                       string
	LockCheckInterval                   time.Duration
	LockLogTimeout                      time.Duration
	MaximumExpirationDuration           time.Duration // Default: 1 day.
	MaximumExpirationDurationPrivileged time.Duration // Default: 1 month.
	ReplicationMaster                   string
}

type ImageDataBase

type ImageDataBase struct {
	Config
	Params

	sync.RWMutex
	// contains filtered or unexported fields
}

func Load added in v0.3.4

func Load(config Config, params Params) (*ImageDataBase, error)

func LoadImageDataBase

func LoadImageDataBase(baseDir string, objSrv objectserver.FullObjectServer,
	replicationMaster string, logger log.DebugLogger) (*ImageDataBase, error)

func (*ImageDataBase) AddImage

func (imdb *ImageDataBase) AddImage(img *image.Image, name string,
	authInfo *srpc.AuthInformation) error

func (*ImageDataBase) ChangeImageExpiration

func (imdb *ImageDataBase) ChangeImageExpiration(name string,
	expiresAt time.Time, authInfo *srpc.AuthInformation) (bool, error)

func (*ImageDataBase) CheckDirectory

func (imdb *ImageDataBase) CheckDirectory(name string) bool

func (*ImageDataBase) CheckImage

func (imdb *ImageDataBase) CheckImage(name string) bool

func (*ImageDataBase) ChownDirectory

func (imdb *ImageDataBase) ChownDirectory(dirname, ownerGroup string,
	authInfo *srpc.AuthInformation) error

func (*ImageDataBase) CountDirectories

func (imdb *ImageDataBase) CountDirectories() uint

func (*ImageDataBase) CountImages

func (imdb *ImageDataBase) CountImages() uint

func (*ImageDataBase) DeleteImage

func (imdb *ImageDataBase) DeleteImage(name string,
	authInfo *srpc.AuthInformation) error

func (*ImageDataBase) DeleteUnreferencedObjects

func (imdb *ImageDataBase) DeleteUnreferencedObjects(percentage uint8,
	bytes uint64) error

DeleteUnreferencedObjects will delete some or all unreferenced objects. Objects are randomly selected for deletion, until both the percentage and bytes thresholds are satisfied. If an image upload/replication is in process this operation is unsafe as it may delete objects that the new image will be using.

func (*ImageDataBase) DoWithPendingImage

func (imdb *ImageDataBase) DoWithPendingImage(img *image.Image,
	doFunc func() error) error

func (*ImageDataBase) FindLatestImage

func (imdb *ImageDataBase) FindLatestImage(
	request proto.FindLatestImageRequest) (string, error)

func (*ImageDataBase) GetImage

func (imdb *ImageDataBase) GetImage(name string) *image.Image

func (*ImageDataBase) GetUnreferencedObjectsStatistics

func (imdb *ImageDataBase) GetUnreferencedObjectsStatistics() (uint64, uint64)

func (*ImageDataBase) ListDirectories

func (imdb *ImageDataBase) ListDirectories() []image.Directory

func (*ImageDataBase) ListImages

func (imdb *ImageDataBase) ListImages() []string

func (*ImageDataBase) ListSelectedImages added in v0.3.4

func (imdb *ImageDataBase) ListSelectedImages(
	request proto.ListSelectedImagesRequest) []string

func (*ImageDataBase) ListUnreferencedObjects

func (imdb *ImageDataBase) ListUnreferencedObjects() map[hash.Hash]uint64

ListUnreferencedObjects will return a map listing all the objects and their corresponding sizes which are not referenced by an image. Note that some objects may have been recently added and the referencing image may not yet be present (i.e. it may be added after missing objects are uploaded).

func (*ImageDataBase) MakeDirectory

func (imdb *ImageDataBase) MakeDirectory(dirname string,
	authInfo *srpc.AuthInformation) error

func (*ImageDataBase) ObjectServer

func (imdb *ImageDataBase) ObjectServer() objectserver.ObjectServer

func (*ImageDataBase) RegisterAddNotifier

func (imdb *ImageDataBase) RegisterAddNotifier() <-chan string

func (*ImageDataBase) RegisterDeleteNotifier

func (imdb *ImageDataBase) RegisterDeleteNotifier() <-chan string

func (*ImageDataBase) RegisterMakeDirectoryNotifier

func (imdb *ImageDataBase) RegisterMakeDirectoryNotifier() <-chan image.Directory

func (*ImageDataBase) UnregisterAddNotifier

func (imdb *ImageDataBase) UnregisterAddNotifier(channel <-chan string)

func (*ImageDataBase) UnregisterDeleteNotifier

func (imdb *ImageDataBase) UnregisterDeleteNotifier(channel <-chan string)

func (*ImageDataBase) UnregisterMakeDirectoryNotifier

func (imdb *ImageDataBase) UnregisterMakeDirectoryNotifier(
	channel <-chan image.Directory)

func (*ImageDataBase) UpdateDirectory

func (imdb *ImageDataBase) UpdateDirectory(directory image.Directory) error

func (*ImageDataBase) WriteHtml

func (imdb *ImageDataBase) WriteHtml(writer io.Writer)

type Params added in v0.3.4

type Params struct {
	Logger       log.DebugLogger
	ObjectServer objectserver.FullObjectServer
}

Jump to

Keyboard shortcuts

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