gcp

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CtxPubSubKey = util.CtxKey("ctxPSKey")

	TopicQueue = "queue"
)
View Source
const (
	PermPublic  = Perm("public")
	PermPrivate = Perm("private")
	PermTmp     = Perm("tmp")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrHandler

type AttrHandler interface {
	GetAttr() map[string]string
	Handler(msg *pubsub.Message)
}

type GcpConf

type GcpConf struct {
	CredentialsFile string `yaml:"credentailsFile"`
	Bucket          string
	PublicBucket    string `yaml:"publicBucket"`
	TmpBucket       string `yaml:"tmpBucket"`
	// contains filtered or unexported fields
}

func (*GcpConf) GetAttr

func (gcp *GcpConf) GetAttr(ctx context.Context, key string, pm Perm) (*storage.ObjectAttrs, error)

func (*GcpConf) GetPublicUrl

func (gcp *GcpConf) GetPublicUrl(ctx context.Context, key string) (myurl string, err error)

func (*GcpConf) NewPubSub

func (conf *GcpConf) NewPubSub(ctx context.Context, l log.Logger) PubSub

func (*GcpConf) OpenFile

func (gcp *GcpConf) OpenFile(ctx context.Context, key string, pm Perm) (io.Reader, error)

func (*GcpConf) RemoveObject

func (gcp *GcpConf) RemoveObject(ctx context.Context, key string, pm Perm) error

func (*GcpConf) SignedURL

func (gcp *GcpConf) SignedURL(key string, contentType string, pm Perm, expDuration time.Duration) (url string, err error)

func (*GcpConf) Write

func (gcp *GcpConf) Write(ctx context.Context, key string, pm Perm, writeData func(w io.Writer) error) (path string, err error)

func (*GcpConf) WriteString

func (gcp *GcpConf) WriteString(ctx context.Context, key string, content string, pm Perm) error

type Perm

type Perm string

type PubSub

type PubSub interface {
	Publish(topicID string, msg []byte, attributes map[string]string) error
	Subcribe(sh SubHandler)
	Close()
}

func GetPubSubByReq

func GetPubSubByReq(req *http.Request) PubSub

type PubSubConf

type PubSubConf interface {
	NewPubSub(ctx context.Context, l log.Logger) PubSub
}

type Storage

type Storage interface {
	GetAttr(ctx context.Context, key string, pm Perm) (*storage.ObjectAttrs, error)
	RemoveObject(ctx context.Context, key string, pm Perm) error
	GetPublicUrl(ctx context.Context, object string) (myurl string, err error)
	WriteString(ctx context.Context, key string, content string, pm Perm) error
	Write(ctx context.Context, key string, pm Perm, writeData func(w io.Writer) error) (path string, err error)
	OpenFile(ctx context.Context, key string, pm Perm) (io.Reader, error)
	SignedURL(key string, contentType string, pm Perm, expDuration time.Duration) (url string, err error)
}

type SubHandler

type SubHandler interface {
	GetSubID() string
	Handler(msg *pubsub.Message)
}

Jump to

Keyboard shortcuts

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