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

orgshare

package
v1.17.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ancestors

func Ancestors(ctx context.Context, orgID, parentID int64) ([]*share_model.ShareItem, error)

Ancestors walks from a folder up to the root.

func Append

func Append(ctx context.Context, orgID int64, uploadID string, start int64, r io.Reader, length int64) (*share_model.ShareUpload, error)

Append writes one chunk. Chunks may arrive out of order.

func BeginUpload

func BeginUpload(ctx context.Context, orgID, uploaderID, parentID int64, relativePath string, size int64, permanent, resume bool) (*share_model.ShareUpload, error)

BeginUpload creates parent folders and a resumable session. resume returns an existing session for the same object instead of reserving the quota twice.

func Cleanup

func Cleanup(ctx context.Context, now time.Time) error

Cleanup deletes expired objects and abandoned uploads.

func Clear

func Clear(ctx context.Context, orgID int64) error

Clear removes every object in the organization share.

func Complete

func Complete(ctx context.Context, orgID int64, uploadID string) (*share_model.ShareItem, error)

Complete moves a finished upload into the share store.

func CreateText

func CreateText(ctx context.Context, orgID, uploaderID, parentID int64, name, body string, permanent bool) (*share_model.ShareItem, error)

CreateText stores a shared note.

func Delete

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

Delete removes one object. Directories remove their children first.

func List

func List(ctx context.Context, orgID, parentID int64) ([]*share_model.ShareItem, error)

List returns one folder after deleting expired objects.

func Open

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

Open returns a file object for streaming download.

func QuotaLimit

func QuotaLimit(ctx context.Context, orgID int64) (int64, bool, error)

QuotaLimit is the per-organization cap, or the server default when no override is stored.

func Root

func Root() string

Root is the organization share directory. It is not a Git or LFS path.

func SetPermanent

func SetPermanent(ctx context.Context, orgID, id int64, permanent bool) (*share_model.ShareItem, error)

SetPermanent changes one object's deadline. permanent false applies the configured lifetime from now.

func SetQuota

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

SetQuota stores a site-admin override. Non-positive maxBytes restores the default.

func UploadMissing

func UploadMissing(upload *share_model.ShareUpload) ([]orgshare.Span, error)

UploadMissing returns byte ranges that still need to be sent.

Types

type DiskReport

type DiskReport struct {
	Path      string  `json:"path"`
	Capacity  int64   `json:"capacity_bytes"`
	Available int64   `json:"available_bytes"`
	Reserve   int64   `json:"reserve_bytes"`
	Error     string  `json:"error,omitempty"`
	Orgs      []Usage `json:"orgs"`
}

DiskReport is the share volume plus each organization.

func Report

func Report(ctx context.Context, orgs []Usage) (*DiskReport, error)

Report reads the share volume and every organization that has a name.

type Usage

type Usage struct {
	OrgID    int64  `json:"org_id"`
	Name     string `json:"name"`
	Used     int64  `json:"used_bytes"`
	Quota    int64  `json:"quota_bytes"`
	Files    int64  `json:"files"`
	Override bool   `json:"override"`
}

Usage is one organization row on the admin page.

func FillUsage

func FillUsage(ctx context.Context, orgID int64, name string) (Usage, error)

FillUsage loads used bytes and the effective quota for one organization.

Jump to

Keyboard shortcuts

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