Help us shape the future of Go! Take the 2026 Go Developer Survey

softwarecenter

package
v1.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package softwarecenter implements a single-writer organization file share outside Git/LFS.

Index

Constants

View Source
const (
	DefaultQuota int64 = 100 * 1024 * 1024 * 1024
	MaxQuota     int64 = 10 * 1024 * 1024 * 1024 * 1024
	MaxEntries         = 20000
)

Variables

View Source
var (
	ErrInvalid      = errors.New("invalid file or folder")
	ErrConflict     = errors.New("name already exists or folder changed")
	ErrQuota        = errors.New("organization storage quota exceeded")
	ErrBusy         = errors.New("upload capacity busy")
	ErrDiskCapacity = errors.New("insufficient unreserved disk capacity")
)

Functions

func Delete

func Delete(ctx context.Context, orgID int64, id string) error

func Rename

func Rename(ctx context.Context, orgID int64, id, name string) error

func SetQuota

func SetQuota(ctx context.Context, orgID, quota int64) error

Types

type Node

type Node struct {
	ID        string `json:"id"`
	Parent    string `json:"parent"`
	Name      string `json:"name"`
	Directory bool   `json:"directory"`
	Size      int64  `json:"size"`
	Digest    string `json:"digest,omitempty"`
	Modified  int64  `json:"modified"`
	UserID    int64  `json:"user_id"`
}

func CreateFolder

func CreateFolder(ctx context.Context, orgID, userID int64, parent, name string) (*Node, error)

func Open

func Open(ctx context.Context, orgID int64, id string) (*Node, *os.File, error)

func Upload

func Upload(ctx context.Context, orgID, userID int64, parent, name string, size int64, body io.Reader) (*Node, error)

type Reservation

type Reservation struct {
	Parent  string `json:"parent"`
	Name    string `json:"name"`
	Size    int64  `json:"size"`
	Started int64  `json:"started"`
}

type State

type State struct {
	Version int                    `json:"version"`
	Quota   int64                  `json:"quota"`
	Nodes   map[string]*Node       `json:"nodes"`
	Uploads map[string]Reservation `json:"uploads"`
	Garbage map[string]int64       `json:"garbage,omitempty"`
}

func Load

func Load(ctx context.Context, orgID int64) (*State, error)

func Snapshot

func Snapshot(ctx context.Context, orgID int64) (*State, error)

Snapshot is immutable and short-lived; membership is checked separately on every HTTP request.

func (*State) Reserved

func (s *State) Reserved() int64

func (*State) Used

func (s *State) Used() int64

Jump to

Keyboard shortcuts

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