Versions in this module Expand all Collapse all v0 v0.3.0 Jul 12, 2023 Changes in this version + var ErrorEmptyState = errors.New("state is empty") + var ErrorFileNotFound = errors.New("not found") + var ErrorKeyExists = errors.New("key already exists in state") + var ErrorNotFound = errors.New("key not found in state") + var ErrorReadOnly = errors.New("state is read-only") + func ArgListContains(args Arguments, arg Argument) bool + func ArgumentTypesEqual(arg Argument, argTypes ...ArgumentType) bool + func BucketAndPath(u *url.URL) (string, string) + func EqualArgs(a []Argument, b []Argument) bool + func GetValueAsString(ctx context.Context, r Reader, arg Argument) (string, error) + func MustGetBool(s Handler, ctx context.Context, arg Argument) bool + func MustGetDirectory(s Handler, ctx context.Context, arg Argument) fs.FS + func MustGetDirectoryString(s Handler, ctx context.Context, arg Argument) string + func MustGetFile(s Handler, ctx context.Context, arg Argument) *os.File + func MustGetFloat64(s Handler, ctx context.Context, arg Argument) float64 + func MustGetInt64(s Handler, ctx context.Context, arg Argument) int64 + func MustGetString(s Handler, ctx context.Context, arg Argument) string + func SetValueFromJSON(ctx context.Context, w Writer, value StateValueJSON) error + type ArgMapReader struct + func NewArgMapReader(defaults args.ArgMap) *ArgMapReader + func (s *ArgMapReader) Exists(ctx context.Context, arg Argument) (bool, error) + func (s *ArgMapReader) GetBool(ctx context.Context, arg Argument) (bool, error) + func (s *ArgMapReader) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (s *ArgMapReader) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (s *ArgMapReader) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (s *ArgMapReader) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (s *ArgMapReader) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (s *ArgMapReader) GetString(ctx context.Context, arg Argument) (string, error) + type Argument struct + Key string + Type ArgumentType + func NewBoolArgument(key string) Argument + func NewDirectoryArgument(key string) Argument + func NewFileArgument(key string) Argument + func NewFloat64Argument(key string) Argument + func NewInt64Argument(key string) Argument + func NewSecretArgument(key string) Argument + func NewStringArgument(key string) Argument + func NewUnpackagedDirectoryArgument(key string) Argument + func Without(args []Argument, exclude []Argument) []Argument + type ArgumentType int + const ArgumentTypeBool + const ArgumentTypeFS + const ArgumentTypeFile + const ArgumentTypeFloat64 + const ArgumentTypeInt64 + const ArgumentTypeSecret + const ArgumentTypeString + const ArgumentTypeUnpackagedFS + func (a ArgumentType) String() string + type Arguments []Argument + func (a *Arguments) String() string + type FilesystemState struct + func NewFilesystemState(path string) (*FilesystemState, error) + func (f *FilesystemState) Exists(ctx context.Context, arg Argument) (bool, error) + func (f *FilesystemState) GetBool(ctx context.Context, arg Argument) (bool, error) + func (f *FilesystemState) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (f *FilesystemState) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (f *FilesystemState) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (f *FilesystemState) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (f *FilesystemState) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (f *FilesystemState) GetString(ctx context.Context, arg Argument) (string, error) + func (f *FilesystemState) SetBool(ctx context.Context, arg Argument, value bool) error + func (f *FilesystemState) SetDirectory(ctx context.Context, arg Argument, value string) error + func (f *FilesystemState) SetFile(ctx context.Context, arg Argument, value string) error + func (f *FilesystemState) SetFileReader(ctx context.Context, arg Argument, value io.Reader) (string, error) + func (f *FilesystemState) SetFloat64(ctx context.Context, arg Argument, value float64) error + func (f *FilesystemState) SetInt64(ctx context.Context, arg Argument, value int64) error + func (f *FilesystemState) SetString(ctx context.Context, arg Argument, value string) error + type GCSHandler struct + func NewGCSHandler(client *storage.Client, u *url.URL) (*GCSHandler, error) + type GCSObjectStorage struct + Client *storage.Client + func (s *GCSObjectStorage) GetObject(ctx context.Context, bucket, key string) (*GetObjectResponse, error) + func (s *GCSObjectStorage) PutObject(ctx context.Context, bucket, key string, body io.Reader) error + type GetObjectResponse struct + Body io.ReadCloser + type Handler interface + type HandlerLogWrapper struct + func HandlerWithLogs(log logrus.FieldLogger, state Handler) *HandlerLogWrapper + type JSONState map[string]StateValueJSON + type NoOpHandler struct + func NewNoOpHandler() *NoOpHandler + func (n *NoOpHandler) Exists(ctx context.Context, arg Argument) (bool, error) + func (n *NoOpHandler) GetBool(ctx context.Context, arg Argument) (bool, error) + func (n *NoOpHandler) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (n *NoOpHandler) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (n *NoOpHandler) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (n *NoOpHandler) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (n *NoOpHandler) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (n *NoOpHandler) GetString(ctx context.Context, arg Argument) (string, error) + func (n *NoOpHandler) SetBool(ctx context.Context, arg Argument, val bool) error + func (n *NoOpHandler) SetDirectory(ctx context.Context, arg Argument, dir string) error + func (n *NoOpHandler) SetFile(ctx context.Context, arg Argument, path string) error + func (n *NoOpHandler) SetFileReader(ctx context.Context, arg Argument, r io.Reader) (string, error) + func (n *NoOpHandler) SetFloat64(ctx context.Context, arg Argument, val float64) error + func (n *NoOpHandler) SetInt64(ctx context.Context, arg Argument, val int64) error + func (n *NoOpHandler) SetString(ctx context.Context, arg Argument, val string) error + type ObjectStorage interface + GetObject func(ctx context.Context, bucket, key string) (*GetObjectResponse, error) + PutObject func(ctx context.Context, bucket, key string, body io.Reader) error + type ObjectStorageHandler struct + BasePath string + Bucket string + Storage ObjectStorage + func NewObjectStorageHandler(storage ObjectStorage, bucket, base string) *ObjectStorageHandler + func (s *ObjectStorageHandler) Exists(ctx context.Context, arg Argument) (bool, error) + func (s *ObjectStorageHandler) GetBool(ctx context.Context, arg Argument) (bool, error) + func (s *ObjectStorageHandler) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (s *ObjectStorageHandler) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (s *ObjectStorageHandler) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (s *ObjectStorageHandler) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (s *ObjectStorageHandler) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (s *ObjectStorageHandler) GetString(ctx context.Context, arg Argument) (string, error) + func (s *ObjectStorageHandler) SetBool(ctx context.Context, arg Argument, value bool) error + func (s *ObjectStorageHandler) SetDirectory(ctx context.Context, arg Argument, path string) error + func (s *ObjectStorageHandler) SetFile(ctx context.Context, arg Argument, path string) error + func (s *ObjectStorageHandler) SetFileReader(ctx context.Context, arg Argument, r io.Reader) (string, error) + func (s *ObjectStorageHandler) SetFloat64(ctx context.Context, arg Argument, value float64) error + func (s *ObjectStorageHandler) SetInt64(ctx context.Context, arg Argument, value int64) error + func (s *ObjectStorageHandler) SetString(ctx context.Context, arg Argument, value string) error + type Observer struct + func NewObserver(h Handler) *Observer + func (o *Observer) CondFor(ctx context.Context, arg Argument) *sync.Cond + func (o *Observer) Exists(ctx context.Context, arg Argument) (bool, error) + func (o *Observer) GetBool(ctx context.Context, arg Argument) (bool, error) + func (o *Observer) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (o *Observer) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (o *Observer) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (o *Observer) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (o *Observer) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (o *Observer) GetString(ctx context.Context, arg Argument) (string, error) + func (o *Observer) Notify(ctx context.Context, arg Argument) + func (o *Observer) SetBool(ctx context.Context, arg Argument, val bool) error + func (o *Observer) SetDirectory(ctx context.Context, arg Argument, dir string) error + func (o *Observer) SetFile(ctx context.Context, arg Argument, path string) error + func (o *Observer) SetFileReader(ctx context.Context, arg Argument, r io.Reader) (string, error) + func (o *Observer) SetFloat64(ctx context.Context, arg Argument, val float64) error + func (o *Observer) SetInt64(ctx context.Context, arg Argument, val int64) error + func (o *Observer) SetString(ctx context.Context, arg Argument, val string) error + type Reader interface + Exists func(context.Context, Argument) (bool, error) + GetBool func(context.Context, Argument) (bool, error) + GetDirectory func(context.Context, Argument) (fs.FS, error) + GetDirectoryString func(context.Context, Argument) (string, error) + GetFile func(context.Context, Argument) (*os.File, error) + GetFloat64 func(context.Context, Argument) (float64, error) + GetInt64 func(context.Context, Argument) (int64, error) + GetString func(context.Context, Argument) (string, error) + type ReaderLogWrapper struct + Log logrus.FieldLogger + func ReaderWithLogs(log logrus.FieldLogger, state Reader) *ReaderLogWrapper + func (s *ReaderLogWrapper) Exists(ctx context.Context, arg Argument) (bool, error) + func (s *ReaderLogWrapper) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (s *ReaderLogWrapper) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (s *ReaderLogWrapper) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (s *ReaderLogWrapper) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (s *ReaderLogWrapper) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (s *ReaderLogWrapper) GetString(ctx context.Context, arg Argument) (string, error) + type S3Handler struct + func NewS3Handler(client *s3.Client, u *url.URL) (*S3Handler, error) + type S3ObjectStorage struct + Client *s3.Client + func (s *S3ObjectStorage) GetObject(ctx context.Context, bucket, key string) (*GetObjectResponse, error) + func (s *S3ObjectStorage) PutObject(ctx context.Context, bucket, key string, body io.Reader) error + type State struct + Fallback []Reader + Handler Handler + Log logrus.FieldLogger + func NewDefaultState(ctx context.Context, log logrus.FieldLogger, pargs *args.PipelineArgs) (*State, error) + func (s *State) Exists(ctx context.Context, arg Argument) (bool, error) + func (s *State) GetBool(ctx context.Context, arg Argument) (bool, error) + func (s *State) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (s *State) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (s *State) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (s *State) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (s *State) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (s *State) GetString(ctx context.Context, arg Argument) (string, error) + func (s *State) SetBool(ctx context.Context, arg Argument, value bool) error + func (s *State) SetDirectory(ctx context.Context, arg Argument, path string) error + func (s *State) SetFile(ctx context.Context, arg Argument, path string) error + func (s *State) SetFileReader(ctx context.Context, arg Argument, r io.Reader) (string, error) + func (s *State) SetFloat64(ctx context.Context, arg Argument, value float64) error + func (s *State) SetInt64(ctx context.Context, arg Argument, value int64) error + func (s *State) SetString(ctx context.Context, arg Argument, value string) error + type StateValueJSON struct + Argument Argument + Value any + type StdinReader struct + func NewStdinReader(in io.Reader, out io.Writer) *StdinReader + func (s *StdinReader) Exists(ctx context.Context, arg Argument) (bool, error) + func (s *StdinReader) Get(arg Argument) (string, error) + func (s *StdinReader) GetBool(ctx context.Context, arg Argument) (bool, error) + func (s *StdinReader) GetDirectory(ctx context.Context, arg Argument) (fs.FS, error) + func (s *StdinReader) GetDirectoryString(ctx context.Context, arg Argument) (string, error) + func (s *StdinReader) GetFile(ctx context.Context, arg Argument) (*os.File, error) + func (s *StdinReader) GetFloat64(ctx context.Context, arg Argument) (float64, error) + func (s *StdinReader) GetInt64(ctx context.Context, arg Argument) (int64, error) + func (s *StdinReader) GetString(ctx context.Context, arg Argument) (string, error) + type Writer interface + SetBool func(context.Context, Argument, bool) error + SetDirectory func(context.Context, Argument, string) error + SetFile func(context.Context, Argument, string) error + SetFileReader func(context.Context, Argument, io.Reader) (string, error) + SetFloat64 func(context.Context, Argument, float64) error + SetInt64 func(context.Context, Argument, int64) error + SetString func(context.Context, Argument, string) error + type WriterLogWrapper struct + Log logrus.FieldLogger + func WriterWithLogs(log logrus.FieldLogger, state Writer) *WriterLogWrapper + func (s *WriterLogWrapper) SetDirectory(ctx context.Context, arg Argument, val string) error + func (s *WriterLogWrapper) SetFile(ctx context.Context, arg Argument, val string) error + func (s *WriterLogWrapper) SetFileReader(ctx context.Context, arg Argument, val io.Reader) (string, error) + func (s *WriterLogWrapper) SetFloat64(ctx context.Context, arg Argument, val float64) error + func (s *WriterLogWrapper) SetInt64(ctx context.Context, arg Argument, val int64) error + func (s *WriterLogWrapper) SetString(ctx context.Context, arg Argument, val string) error