versions

package
v5.0.0-alpha00 Latest Latest
Warning

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

Go to latest
Published: May 19, 2026 License: AGPL-3.0 Imports: 36 Imported by: 0

Documentation

Overview

Package versions provides a versioning mechanism for files modifications

Index

Constants

This section is empty.

Variables

Functions

func DataSourceForPolicy

func DataSourceForPolicy(ctx context.Context, policy *tree.VersioningPolicy) (nodes.LoadedSource, error)

DataSourceForPolicy finds the LoadedSource for a given VersioningPolicy - Uses "DS: default"+"Bucket: versions" for backward compatibility.

func DefaultLocation

func DefaultLocation(ctx context.Context, originalUUID, versionUUID string) *tree.Node

DefaultLocation returns legacy configuration for versions stored without Location

func DispatchChangeLogsByPeriod

func DispatchChangeLogsByPeriod(pruningPeriods []*pruningPeriod, changesChan chan *tree.ContentRevision) ([]*pruningPeriod, error)

DispatchChangeLogsByPeriod places each change in its corresponding period

func LocationForNode

func LocationForNode(ctx context.Context, node *tree.Node, versionId string) (*tree.Node, error)

LocationForNode computes version location for the current name

func Migrate

func Migrate(main, fromCtx, toCtx context.Context, dryRun bool, status chan service.MigratorStatus) (map[string]int, error)

func ParseDuration

func ParseDuration(duration string) (d time.Duration, e error)

ParseDuration is similar to time.ParseDuration, with specific case for "d" suffix on duration.

func PolicyForNode

func PolicyForNode(ctx context.Context, node *tree.Node) *tree.VersioningPolicy

PolicyForNode checks datasource name and find corresponding VersioningPolicy (if set). Returns nil otherwise.

func PreparePeriods

func PreparePeriods(startTime time.Time, periods []*tree.VersioningKeepPeriod) ([]*pruningPeriod, error)

PreparePeriods computes the actual periods from definitions.

func PruneAllWithMaxSize

func PruneAllWithMaxSize(periods []*pruningPeriod, maxSize int64) (toBeRemoved []*tree.ContentRevision, remaining []*tree.ContentRevision)

PruneAllWithMaxSize checks overall size and removes older versions. It should be called after pruning by periods.

Types

type DAO

type DAO interface {
	GetLastVersion(ctx context.Context, nodeUuid string) (*tree.ContentRevision, error)
	GetVersions(ctx context.Context, nodeUuid string, offset int64, limit int64, sortField string, sortDesc bool, filters map[string]any) (chan *tree.ContentRevision, error)
	GetVersion(ctx context.Context, nodeUuid string, versionId string) (*tree.ContentRevision, error)
	StoreVersion(ctx context.Context, nodeUuid string, revision *tree.ContentRevision) error
	DeleteVersionsForNode(ctx context.Context, nodeUuid string, versions ...string) error
	DeleteVersionsForNodes(ctx context.Context, nodeUuid []string) error
	ListAllVersionedNodesUuids(ctx context.Context) (chan string, chan bool, chan error)
}

type OnDeleteVersionsAction

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

func (*OnDeleteVersionsAction) CreateParents

func (c *OnDeleteVersionsAction) CreateParents(ctx context.Context, dirPath string) error

func (*OnDeleteVersionsAction) GetDescription

func (c *OnDeleteVersionsAction) GetDescription(lang ...string) actions.ActionDescription

func (*OnDeleteVersionsAction) GetName

func (c *OnDeleteVersionsAction) GetName() string

GetName returns the Unique identifier.

func (*OnDeleteVersionsAction) GetParametersForm

func (c *OnDeleteVersionsAction) GetParametersForm(context.Context) *forms.Form

func (*OnDeleteVersionsAction) Init

func (c *OnDeleteVersionsAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error

Init passes the parameters to a newly created PruneVersionsAction.

func (*OnDeleteVersionsAction) Run

Run processes the actual action code.

type PruneVersionsAction

type PruneVersionsAction struct{}

func (*PruneVersionsAction) GetDescription

func (c *PruneVersionsAction) GetDescription(lang ...string) actions.ActionDescription

func (*PruneVersionsAction) GetName

func (c *PruneVersionsAction) GetName() string

GetName returns the Unique identifier.

func (*PruneVersionsAction) GetParametersForm

func (c *PruneVersionsAction) GetParametersForm(context.Context) *forms.Form

func (*PruneVersionsAction) Init

func (c *PruneVersionsAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error

Init passes the parameters to a newly created PruneVersionsAction.

func (*PruneVersionsAction) Run

Run processes the actual action code.

type VersionAction

type VersionAction struct{}

func (*VersionAction) GetDescription

func (c *VersionAction) GetDescription(lang ...string) actions.ActionDescription

func (*VersionAction) GetName

func (c *VersionAction) GetName() string

GetName returns the Unique identifier for this VersionAction

func (*VersionAction) GetParametersForm

func (c *VersionAction) GetParametersForm(context.Context) *forms.Form

func (*VersionAction) Init

func (c *VersionAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error

Init sets this VersionAction parameters.

func (*VersionAction) Run

Run processes the actual action code

Directories

Path Synopsis
dao
service
Package service is in charge of storing versions metadata
Package service is in charge of storing versions metadata
Package lang provides i18n strings for versions service
Package lang provides i18n strings for versions service

Jump to

Keyboard shortcuts

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