pkg

package
v0.0.0-...-bf41b92 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(files []string) io.Reader

func Decompress

func Decompress(ctx *context.Context, r io.Reader, out chan (*DecompressedFile)) error

Decompress is broken this is all just WIP TODO(manuel, 2023-01-05): fix this, not sure if this is even really that needed

func DownloadLogs

func DownloadLogs(
	ctx context.Context,
	settings *BucketSettings,
	filter *ListFilter,
	outputDirectory string,
	progressCh chan ProgressEvent,
) error

func HorseStapleToUUID

func HorseStapleToUUID(id string) (uuid.UUID, error)

func ListLogBucketKeys

func ListLogBucketKeys(
	ctx context.Context,
	settings *BucketSettings,
	filter *ListFilter,
	entryCh chan LogEntry,
) error

func ParseDate

func ParseDate(value string) (time.Time, error)

func UUIDToHorseStaple

func UUIDToHorseStaple(id uuid.UUID) string

func UploadLogs

func UploadLogs(ctx context.Context, settings *BucketSettings, data *UploadData, progressCh chan ProgressEvent) error

Types

type BucketSettings

type BucketSettings struct {
	// The AWS region that the bucket is in.
	Region      string
	Bucket      string
	Credentials *Credentials
}

func (*BucketSettings) CreateSession

func (us *BucketSettings) CreateSession() (*session.Session, error)

type Credentials

type Credentials struct {
	AccessKeyID     string    `json:"access_key"`
	SecretAccessKey string    `json:"secret_key"`
	SessionToken    string    `json:"session_token"`
	Expiration      time.Time `json:"expiration"`
}

func GetUploadCredentials

func GetUploadCredentials(ctx context.Context, api string) (*Credentials, error)

type DecompressedFile

type DecompressedFile struct {
	Name string
	Body io.Reader
}

type ListFilter

type ListFilter struct {
	From   *time.Time
	To     *time.Time
	Globs  []string
	Prefix string
}

type LogEntry

type LogEntry struct {
	Key      string
	Date     time.Time
	Size     int64
	Comment  string
	Metadata map[string]string
	FileName string
	UUID     uuid.UUID
}

type ProgressEvent

type ProgressEvent struct {
	StepProgress float64
	Step         string
	IsError      bool
}

type ReaderWithProgress

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

func NewReaderWithProgress

func NewReaderWithProgress(
	reader io.ReadSeeker,
	progressCh chan ProgressEvent,
	totalBytes int64,
	stepName string,
) *ReaderWithProgress

func (ReaderWithProgress) Read

func (r ReaderWithProgress) Read(p []byte) (int, error)

func (*ReaderWithProgress) Seek

func (r *ReaderWithProgress) Seek(offset int64, whence int) (int64, error)

type TokenRequest

type TokenRequest struct {
	AppId string `json:"app_id"`
}

type UploadData

type UploadData struct {
	Files    []string
	Comment  string
	Metadata map[string]interface{}
}

type WriterWithProgress

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

func NewWriterWithProgress

func NewWriterWithProgress(
	writer io.WriterAt,
	progressCh chan ProgressEvent,
	totalBytes int64,
	stepName string,
) *WriterWithProgress

func (*WriterWithProgress) WriteAt

func (w *WriterWithProgress) WriteAt(p []byte, off int64) (int, error)

Jump to

Keyboard shortcuts

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