Back to godoc.org

Package pubsub

v0.0.0-...-018eb3e
Latest Go to latest

The highest tagged major version is .

Published: Feb 20, 2020 | License: Apache-2.0 | Module: github.com/LeKovr/sfs

Overview

Package upload implements image upload handlers.

Index

Constants

const (
	// ErrNoSingleFile returned when does not contain single file in field 'file'
	ErrNoSingleFile = "field 'file' does not contains single item"
)

Variables

var (
	// ErrNoAnyFile returned when request does not contain item in field 'files[]'
	ErrNoAnyFile = errors.New("field 'file' does not contains any item")
	// ErrNoAuth returned on Internal Server Error (no auth for upload)
	ErrNoAuth = errors.New("This endpoint must be under AuthRequired")
)

func Unmarshal

func Unmarshal(data []byte, v interface{}) error

type Config

type Config struct {
	CookieName   string `long:"cookie" default:"sfs_auth" description:"Auth cookie name"`
	HeaderName   string `long:"header" default:"X-SFS-Auth" description:"Auth header name"`
	CookieMaxAge int    `long:"cookie_ttl" default:"3600" description:"Auth cookie TTL"`
}

Config holds all config vars

type Message

type Message struct {
	Topic   string
	Payload []byte
}

type MessageStream

type MessageStream chan Message

type Service

type Service struct {
	Config *Config
	Log    *log.SugaredLogger
	// contains filtered or unexported fields
}

Service holds the set of active connections and broadcasts messages

func New

func New(cfg Config, logger *log.SugaredLogger) *Service

New creates an Service object

func (Service) Close

func (srv Service) Close()

func (Service) Publish

func (srv Service) Publish(topic string, data interface{}) error

func (*Service) Run

func (srv *Service) Run()

func (Service) Subscribe

func (srv Service) Subscribe(topic string) (Stream, error)

type Stream

type Stream struct {
	Topic    string
	Messages chan Message
	// contains filtered or unexported fields
}

func (Stream) Unsubscribe

func (s Stream) Unsubscribe()

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier