store

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package store abstracts a file system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractCommitIDFromFilename

func ExtractCommitIDFromFilename(filename string) (int, error)

ExtractCommitIDFromFilename gets the commit from a filename: "aaa.1" => 1

func FileInfo

func FileInfo(path string) (time.Time, int64, error)

FileInfo returns file modification time and size.

func FileRead

func FileRead(path string, maxSize int64) ([]byte, error)

FileRead reads bytes from file.

func FindLastConfig

func FindLastConfig(configPathPrefix string, logger hasPrintf) (string, error)

FindLastConfig finds the last file under a path prefix.

func Init

func Init(logger hasPrintf, region string)

Init starts the store by providing a logger and default S3 region.

func ListConfig

func ListConfig(configPathPrefix string, logger hasPrintf) (string, []string, error)

ListConfig retrieves files under a path prefix.

func ListConfigSorted

func ListConfigSorted(configPathPrefix string, reverse bool, logger hasPrintf) (string, []string, error)

ListConfigSorted retrieves the sorted list of files under a path prefix.

func MkDir

func MkDir(path string) error

MkDir creates a new directory.

func S3Path

func S3Path(path string) bool

S3Path checks if path is an aws s3 path.

func S3URL

func S3URL(path string) string

S3URL builds the URL for an S3 bucket. The path is an ARN: "arn:aws:s3:region::bucket/folder/file.xxx"

func SaveNewConfig

func SaveNewConfig(configPathPrefix string, maxFiles int, logger hasPrintf, writeFunc func(HasWrite) error, changesOnly bool, contentType string) (string, error)

SaveNewConfig saves data to a new file. The function writeFunc must be provided to issue the actual data.

Types

type HasWrite

type HasWrite interface {
	Write(p []byte) (int, error)
}

HasWrite is a helper interface for types providing the method Write().

Jump to

Keyboard shortcuts

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