Documentation ¶
Overview ¶
Package versions provides a versioning mechanism for files modifications
Index ¶
- func DispatchChangeLogsByPeriod(pruningPeriods []*pruningPeriod, changesChan chan *tree.ChangeLog, ...) ([]*pruningPeriod, error)
- func ParseDuration(duration string) (d time.Duration, e error)
- 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) 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 PruneVersionsAction
- type VersionAction
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 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) 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 ListAllVersionedNodesUuids() (chan string, chan bool, chan error) }
type PruneVersionsAction ¶
type PruneVersionsAction struct { Handler views.Handler Pool *views.ClientsPool }
func (*PruneVersionsAction) GetName ¶
func (c *PruneVersionsAction) GetName() string
GetName returns the Unique identifier.
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 { Handler views.Handler Pool *views.ClientsPool }
func (*VersionAction) GetName ¶
func (c *VersionAction) GetName() string
GetName returns the Unique identifier for this VersionAction
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