quota

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Manager

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

Manager manages the repo quota for given filesystem root path, including subrepos

func New

func New(path string, maxSize int64) (*Manager, error)

New creates a new quota Manager for given path. It will tally the current disk usage before returning.

func (*Manager) IncUsage

func (m *Manager) IncUsage(by int64)

IncUsage increments the current repo size (which must already be initialized).

func (*Manager) SpaceRemaining

func (m *Manager) SpaceRemaining() int64

SpaceRemaining returns how much space is available in the repo according to s.MaxRepoSize. s.repoSize must already be set. If there is no limit, -1 is returned.

func (*Manager) SpaceUsed

func (m *Manager) SpaceUsed() int64

SpaceUsed returns how much space is used in the repo.

func (*Manager) WrapWriter

func (m *Manager) WrapWriter(req *http.Request, w io.Writer) (io.Writer, int, error)

WrapWriter wraps w in a writer that enforces s.MaxRepoSize. If there is an error, a status code and the error are returned.

Jump to

Keyboard shortcuts

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