Documentation ¶
Overview ¶
Package versions provides a versioning mechanism for files modifications
Index ¶
- func DataSourceForPolicy(ctx context.Context, policy *tree.VersioningPolicy) (views.LoadedSource, error)
- func DefaultLocation(originalUUID, versionUUID string) *tree.Node
- func DispatchChangeLogsByPeriod(pruningPeriods []*pruningPeriod, changesChan chan *tree.ChangeLog, ...) ([]*pruningPeriod, 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.ChangeLog, remaining []*tree.ChangeLog)
- type BoltStore
- func (b *BoltStore) Close() error
- func (b *BoltStore) DeleteVersionsForNode(nodeUuid string, versions ...*tree.ChangeLog) error
- func (b *BoltStore) DeleteVersionsForNodes(nodeUuid []string) error
- func (b *BoltStore) GetLastVersion(nodeUuid string) (log *tree.ChangeLog, err error)
- func (b *BoltStore) GetVersion(nodeUuid string, versionId string) (*tree.ChangeLog, error)
- func (b *BoltStore) GetVersions(nodeUuid string) (chan *tree.ChangeLog, chan bool)
- func (b *BoltStore) ListAllVersionedNodesUuids() (chan string, chan bool, chan error)
- func (b *BoltStore) StoreVersion(nodeUuid string, log *tree.ChangeLog) error
- 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() *forms.Form
- func (c *OnDeleteVersionsAction) Init(job *jobs.Job, cl client.Client, 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() *forms.Form
- func (c *PruneVersionsAction) Init(job *jobs.Job, cl client.Client, 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() *forms.Form
- func (c *VersionAction) Init(job *jobs.Job, cl client.Client, action *jobs.Action) error
- func (c *VersionAction) Run(ctx context.Context, channels *actions.RunnableChannels, ...) (jobs.ActionMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DataSourceForPolicy ¶
func DataSourceForPolicy(ctx context.Context, policy *tree.VersioningPolicy) (views.LoadedSource, error)
DataSourceForPolicy finds the LoadedSource for a given VersioningPolicy - Uses "DS: default"+"Bucket: versions" for backward compatibility.
func DefaultLocation ¶
func DispatchChangeLogsByPeriod ¶
func DispatchChangeLogsByPeriod(pruningPeriods []*pruningPeriod, changesChan chan *tree.ChangeLog, doneChan chan bool) ([]*pruningPeriod, error)
DispatchChangeLogsByPeriod places each change in its corresponding period
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.
Types ¶
type BoltStore ¶
type BoltStore struct { // For Testing purpose : delete file after closing DeleteOnClose bool // Path to the DB file DbPath string // contains filtered or unexported fields }
func (*BoltStore) DeleteVersionsForNode ¶
DeleteVersionsForNode deletes whole node bucket at once.
func (*BoltStore) DeleteVersionsForNodes ¶
DeleteVersionsForNodes delete versions in a batch
func (*BoltStore) GetLastVersion ¶
GetLastVersion retrieves the last version registered for this node.
func (*BoltStore) GetVersion ¶
GetVersion retrieves a specific version from the node bucket.
func (*BoltStore) GetVersions ¶
GetVersions returns all versions from the node bucket, in reverse order (last inserted first).
func (*BoltStore) ListAllVersionedNodesUuids ¶
ListAllVersionedNodesUuids lists all nodes uuids
type DAO ¶
type DAO interface { GetLastVersion(nodeUuid string) (*tree.ChangeLog, error) GetVersions(nodeUuid string) (chan *tree.ChangeLog, chan bool) GetVersion(nodeUuid string, versionId string) (*tree.ChangeLog, error) StoreVersion(nodeUuid string, log *tree.ChangeLog) error DeleteVersionsForNode(nodeUuid string, versions ...*tree.ChangeLog) error DeleteVersionsForNodes(nodeUuid []string) error ListAllVersionedNodesUuids() (chan string, chan bool, chan error) }
type OnDeleteVersionsAction ¶
type OnDeleteVersionsAction struct { Handler views.Handler Pool views.SourcesPool // 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() *forms.Form
func (*OnDeleteVersionsAction) Init ¶
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 { Handler views.Handler Pool views.SourcesPool }
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() *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() *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