spaceallocator

package
v0.0.0-...-20113a8 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: Apache-2.0 Imports: 7 Imported by: 5

Documentation

Overview

spaceallocator helper used to allocate disk space.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAllocation = errors.New("no allocation in progress")
	ErrNoSpace      = errors.New("not enough space")
)

Functions

This section is empty.

Types

type Allocator

type Allocator interface {
	AllocateSpace(size uint64) (Space, error)
	FreeSpace(size uint64)
	AddOutdatedItem(id string, size uint64, timestamp time.Time) error
	RestoreOutdatedItem(id string)
	Close() error
}

Allocator space allocator interface.

func New

func New(path string, partLimit uint, remover ItemRemover) (Allocator, error)

New creates new space allocator.

type ItemRemover

type ItemRemover func(id string) error

ItemRemover requests to remove item in order to free space.

type Space

type Space interface {
	Accept() error
	Release() error
}

Space allocated space interface.

Jump to

Keyboard shortcuts

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