Documentation

Overview

    Package storage provides interface for working with different storage's like local FS and Amazon S3.

    Index

    Constants

    This section is empty.

    Variables

    View Source
    var Log = logrus.New()

      Log implement Logrus logger for debug logging.

      Functions

      func IsAwsContextCanceled

      func IsAwsContextCanceled(err error) bool

      func IsErrNotExist

      func IsErrNotExist(err error) bool

      func IsErrPermission

      func IsErrPermission(err error) bool

      func StrongEtag

      func StrongEtag(s *string) *string

        StrongEtag remove "W/" prefix from ETag. In some cases S3 return ETag with "W/" prefix which mean that it not strong ETag. For easier compare we remove this prefix.

        Types

        type ErrHandlingMask

        type ErrHandlingMask uint8

          ErrHandlingMask is is a bitmask for storing error handling settings.

          const (
          	HandleErrNotExist ErrHandlingMask = 1 << iota
          	HandleErrPermission
          	HandleErrOther = 64
          )

          func (*ErrHandlingMask) Add

          func (f *ErrHandlingMask) Add(flag ErrHandlingMask)

            Add the flag to the bitmask.

            func (ErrHandlingMask) Has

            func (f ErrHandlingMask) Has(flag ErrHandlingMask) bool

              Has checks if the flag is set in the bitmask.

              type Object

              type Object struct {
              	Key                 *string                 `json:"-"`
              	ETag                *string                 `json:"e_tag"`
              	Mtime               *time.Time              `json:"mtime"`
              	Content             *[]byte                 `json:"-"`
              	ContentType         *string                 `json:"content_type"`
              	ContentDisposition  *string                 `json:"content_disposition"`
              	ContentEncoding     *string                 `json:"content_encoding"`
              	ContentLanguage     *string                 `json:"content_language"`
              	Metadata            map[string]*string      `json:"metadata"`
              	ACL                 *string                 `json:"acl"`
              	CacheControl        *string                 `json:"cache_control"`
              	VersionId           *string                 `json:"version_id"`
              	IsLatest            *bool                   `json:"-"`
              	StorageClass        *string                 `json:"storage_class"`
              	AccessControlPolicy *s3.AccessControlPolicy `json:"access_control_policy"`
              }

                Object contain content and metadata of S3 object.

                type Storage

                type Storage interface {
                	WithContext(ctx context.Context)
                	WithRateLimit(limit int) error
                	List(ch chan<- *Object) error
                	PutObject(object *Object) error
                	GetObjectContent(obj *Object) error
                	GetObjectMeta(obj *Object) error
                	GetObjectACL(obj *Object) error
                	DeleteObject(obj *Object) error
                }

                  Storage interface.

                  type Type

                  type Type int

                    Type of Storage.

                    const (
                    	TypeS3 Type = iota + 1
                    	TypeS3Versioned
                    	TypeFS
                    )

                      Storage types.

                      Directories

                      Path Synopsis