actions

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package actions contains the definition of the Session which is used in all of the Hoard actions.

The actions themselves (download, merge, audit, etc.) are defined in subpackages.

Index

Constants

View Source
const ArchivesSubDir = "archives"
View Source
const DownloadsSubDir = "downloads"
View Source
const TmpSubDir = "tmp"

Variables

This section is empty.

Functions

This section is empty.

Types

type Session

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

Session contains all the necessary pieces for performing actions in Hoard. Each action takes the Session as an input parameter and then uses the pieces it needs.

The Session is a per-feed construct. Hoard's simple model for taking advantage of multiple CPUs is to to run operations for each feed in separate goroutines. Each of these goroutines is provided with the Session corresponding to its feed.

func NewInMemorySession

func NewInMemorySession(feed *config.Feed) *Session

NewInMemorySession creates a new session in which all data is stored in-memory. This session is used for testing.

func NewSession

func NewSession(feed *config.Feed, c *config.Config, log *logrus.Logger, ctx context.Context, enableMonitoring bool) *Session

NewSession creates a new Session for production code.

In this session, local stores are based on the filesystem, rooted at the provided workspace. The remote AStore is based on the remote object storage configured in the configuration file.

func (*Session) Ctx

func (s *Session) Ctx() context.Context

Ctx returns the context for this session.

func (*Session) Feed

func (s *Session) Feed() *config.Feed

Feed returns the feed for this session.

func (*Session) LocalAStore

func (s *Session) LocalAStore() storage.AStore

LocalAStore returns the AStore based on the local filesystem.

func (*Session) LocalDStore

func (s *Session) LocalDStore() storage.DStore

LocalDStore returns the DStore based on the local filesystem.

func (*Session) Log

func (s *Session) Log() *logrus.Entry

Log returns an object used for logging in this session.

func (*Session) LogWithHour

func (s *Session) LogWithHour(h hour.Hour) *logrus.Entry

LogWithHour returns an object used for logging information about a specific hour in this session

func (*Session) RemoteAStore

func (s *Session) RemoteAStore() *astore.ReplicatedAStore

RemoteAStore returns the AStore based on remote object storage. The boolean return value is false if not object storage has been configured - in this case, the AStore will be nil.

func (*Session) TempAStore

func (s *Session) TempAStore() (storage.AStore, func() error)

TempDStore creates a new temporary AStore and returns its. The second return value is a closer function that must be invoked to clean up the AStore.

func (*Session) TempDStore

func (s *Session) TempDStore() (storage.DStore, func() error)

TempDStore creates a new temporary DStore and returns its. The second return value is a closer function that must be invoked to clean up the DStore.

Directories

Path Synopsis
Package audit contains the audit action.
Package audit contains the audit action.
Package download contains the download action.
Package download contains the download action.
Package merge contains the merge action.
Package merge contains the merge action.
Package pack contains the pack action.
Package pack contains the pack action.
Package retrieve contains the retrieve action.
Package retrieve contains the retrieve action.
Package upload contains the upload action.
Package upload contains the upload action.

Jump to

Keyboard shortcuts

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