versions

package
v2.0.8+incompatible Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: AGPL-3.0 Imports: 25 Imported by: 9

Documentation

Overview

Package versions provides a versioning mechanism for files modifications

Index

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

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

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.

func PruneAllWithMaxSize

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

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

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 NewBoltStore

func NewBoltStore(fileName string, deleteOnClose ...bool) (*BoltStore, error)

func (*BoltStore) Close

func (b *BoltStore) Close() error

func (*BoltStore) DeleteVersionsForNode

func (b *BoltStore) DeleteVersionsForNode(nodeUuid string, versions ...*tree.ChangeLog) error

DeleteVersionsForNode deletes whole node bucket at once.

func (*BoltStore) DeleteVersionsForNodes

func (b *BoltStore) DeleteVersionsForNodes(nodeUuid []string) error

DeleteVersionsForNodes delete versions in a batch

func (*BoltStore) GetLastVersion

func (b *BoltStore) GetLastVersion(nodeUuid string) (log *tree.ChangeLog, err error)

GetLastVersion retrieves the last version registered for this node.

func (*BoltStore) GetVersion

func (b *BoltStore) GetVersion(nodeUuid string, versionId string) (*tree.ChangeLog, error)

GetVersion retrieves a specific version from the node bucket.

func (*BoltStore) GetVersions

func (b *BoltStore) GetVersions(nodeUuid string) (chan *tree.ChangeLog, chan bool)

GetVersions returns all versions from the node bucket, in reverse order (last inserted first).

func (*BoltStore) ListAllVersionedNodesUuids

func (b *BoltStore) ListAllVersionedNodesUuids() (chan string, chan bool, chan error)

ListAllVersionedNodesUuids lists all nodes uuids

func (*BoltStore) StoreVersion

func (b *BoltStore) StoreVersion(nodeUuid string, log *tree.ChangeLog) error

StoreVersion stores a version in the node bucket.

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 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

func (c *PruneVersionsAction) Init(job *jobs.Job, cl client.Client, 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) GetName

func (c *VersionAction) GetName() string

GetName returns the Unique identifier for this VersionAction

func (*VersionAction) Init

func (c *VersionAction) Init(job *jobs.Job, cl client.Client, action *jobs.Action) error

Init sets this VersionAction parameters.

func (*VersionAction) Run

Run processes the actual action code

Directories

Path Synopsis
Package grpc is in charge of storing versions metadata
Package grpc 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