gcp

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2023 License: MIT Imports: 19 Imported by: 5

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"`
	CredentailsUrl  string `yaml:"credentailsUrl"`
	Bucket          string
	PublicBucket    string `yaml:"publicBucket"`
	TmpBucket       string `yaml:"tmpBucket"`
}

func (*GcpConf) NewPubSub

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

func (*GcpConf) NewStorage added in v1.5.2

func (gcp *GcpConf) NewStorage() (Storage, error)

type GcpDI added in v1.5.2

type GcpDI interface {
	NewStorage() (Storage, 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
	GetDownloadUrl(ctx context.Context, key string, p Perm) (myurl string, err 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)
	GetAccessToken() (*oauth2.Token, 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