Documentation
¶
Overview ¶
Package versions provides a versioning mechanism for files modifications
Index ¶
- Variables
- func DataSourceForPolicy(ctx context.Context, policy *tree.VersioningPolicy) (nodes.LoadedSource, error)
- func DefaultLocation(ctx context.Context, originalUUID, versionUUID string) *tree.Node
- func DispatchChangeLogsByPeriod(pruningPeriods []*pruningPeriod, changesChan chan *tree.ContentRevision) ([]*pruningPeriod, error)
- func LocationForNode(ctx context.Context, node *tree.Node, versionId string) (*tree.Node, error)
- func Migrate(main, fromCtx, toCtx context.Context, dryRun bool, ...) (map[string]int, error)
- func ParseDuration(duration string) (d time.Duration, e error)
- func PolicyForNode(ctx context.Context, node *tree.Node) *tree.VersioningPolicy
- func PreparePeriods(startTime time.Time, periods []*tree.VersioningKeepPeriod) ([]*pruningPeriod, error)
- func PruneAllWithMaxSize(periods []*pruningPeriod, maxSize int64) (toBeRemoved []*tree.ContentRevision, remaining []*tree.ContentRevision)
- type DAO
- type OnDeleteVersionsAction
- func (c *OnDeleteVersionsAction) CreateParents(ctx context.Context, dirPath string) error
- func (c *OnDeleteVersionsAction) GetDescription(lang ...string) actions.ActionDescription
- func (c *OnDeleteVersionsAction) GetName() string
- func (c *OnDeleteVersionsAction) GetParametersForm(context.Context) *forms.Form
- func (c *OnDeleteVersionsAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error
- func (c *OnDeleteVersionsAction) Run(ctx context.Context, channels *actions.RunnableChannels, ...) (*jobs.ActionMessage, error)
- type PruneVersionsAction
- func (c *PruneVersionsAction) GetDescription(lang ...string) actions.ActionDescription
- func (c *PruneVersionsAction) GetName() string
- func (c *PruneVersionsAction) GetParametersForm(context.Context) *forms.Form
- func (c *PruneVersionsAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error
- func (c *PruneVersionsAction) Run(ctx context.Context, channels *actions.RunnableChannels, ...) (*jobs.ActionMessage, error)
- type VersionAction
- func (c *VersionAction) GetDescription(lang ...string) actions.ActionDescription
- func (c *VersionAction) GetName() string
- func (c *VersionAction) GetParametersForm(context.Context) *forms.Form
- func (c *VersionAction) Init(ctx context.Context, job *jobs.Job, action *jobs.Action) error
- func (c *VersionAction) Run(ctx context.Context, channels *actions.RunnableChannels, ...) (*jobs.ActionMessage, error)
Constants ¶
This section is empty.
Variables ¶
var Drivers = service.StorageDrivers{}
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 ¶
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 ¶
LocationForNode computes version location for the current name
func ParseDuration ¶
ParseDuration is similar to time.ParseDuration, with specific case for "d" suffix on duration.
func PolicyForNode ¶
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 ¶
func (c *OnDeleteVersionsAction) Run(ctx context.Context, channels *actions.RunnableChannels, input *jobs.ActionMessage) (*jobs.ActionMessage, error)
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 ¶
Init passes the parameters to a newly created PruneVersionsAction.
func (*PruneVersionsAction) Run ¶
func (c *PruneVersionsAction) Run(ctx context.Context, channels *actions.RunnableChannels, input *jobs.ActionMessage) (*jobs.ActionMessage, error)
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) Run ¶
func (c *VersionAction) Run(ctx context.Context, channels *actions.RunnableChannels, input *jobs.ActionMessage) (*jobs.ActionMessage, error)
Run processes the actual action code