storage

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalRoute

func MarshalRoute(route Route) (string, error)

Types

type LogSession

type LogSession struct {
	App   string `json:"app,omitempty"`
	Space string `json:"space,omitempty"`
	Site  string `json:"site,omitempty"`
	Lines int    `json:lines`
	Tail  bool   `json:tail`
}

type MemoryStorage

type MemoryStorage struct {
	Storage
	// contains filtered or unexported fields
}

func (*MemoryStorage) AddRoute

func (ms *MemoryStorage) AddRoute(route Route) error

func (*MemoryStorage) AddRoutes

func (ms *MemoryStorage) AddRoutes(routes []Route) error

func (*MemoryStorage) GetRouteById

func (ms *MemoryStorage) GetRouteById(Id string) (*Route, error)

func (*MemoryStorage) GetRoutes

func (ms *MemoryStorage) GetRoutes() ([]Route, error)

func (*MemoryStorage) GetSession

func (ms *MemoryStorage) GetSession(key string) (value LogSession, err error)

func (*MemoryStorage) HealthCheck

func (ms *MemoryStorage) HealthCheck() error

func (*MemoryStorage) Init

func (ms *MemoryStorage) Init(url string) error

Url is just a dummy interface.

func (*MemoryStorage) RemoveRoute

func (ms *MemoryStorage) RemoveRoute(route Route) error

func (*MemoryStorage) SetSession

func (ms *MemoryStorage) SetSession(key string, value LogSession, duration time.Duration) error

type PostgresStorage

type PostgresStorage struct {
	Storage
	// contains filtered or unexported fields
}

func (*PostgresStorage) AddRoute

func (rs *PostgresStorage) AddRoute(route Route) error

func (*PostgresStorage) AddRoutes

func (rs *PostgresStorage) AddRoutes(routes []Route) (err error)

func (*PostgresStorage) Close

func (rs *PostgresStorage) Close()

func (*PostgresStorage) GetRouteById

func (rs *PostgresStorage) GetRouteById(Id string) (*Route, error)

func (*PostgresStorage) GetRoutes

func (rs *PostgresStorage) GetRoutes() ([]Route, error)

func (*PostgresStorage) GetSession

func (rs *PostgresStorage) GetSession(key string) (value LogSession, err error)

func (*PostgresStorage) HealthCheck

func (rs *PostgresStorage) HealthCheck() error

func (*PostgresStorage) Init

func (rs *PostgresStorage) Init(url string) error

func (*PostgresStorage) RemoveRoute

func (rs *PostgresStorage) RemoveRoute(route Route) error

func (*PostgresStorage) SetSession

func (rs *PostgresStorage) SetSession(key string, value LogSession, duration time.Duration) error

type RedisStorage

type RedisStorage struct {
	Storage
	// contains filtered or unexported fields
}

func (*RedisStorage) AddRoute

func (rs *RedisStorage) AddRoute(route Route) error

func (*RedisStorage) AddRoutes

func (rs *RedisStorage) AddRoutes(routes []Route) error

func (*RedisStorage) GetRouteById

func (rs *RedisStorage) GetRouteById(Id string) (*Route, error)

func (*RedisStorage) GetRoutes

func (rs *RedisStorage) GetRoutes() ([]Route, error)

func (*RedisStorage) GetSession

func (rs *RedisStorage) GetSession(key string) (value LogSession, err error)

func (*RedisStorage) HealthCheck

func (rs *RedisStorage) HealthCheck() error

func (*RedisStorage) Init

func (rs *RedisStorage) Init(url string) error

func (*RedisStorage) RemoveRoute

func (rs *RedisStorage) RemoveRoute(route Route) error

func (*RedisStorage) SetSession

func (rs *RedisStorage) SetSession(key string, value LogSession, duration time.Duration) error

type Route

type Route struct {
	Id             string    `json:"id"`
	Space          string    `json:"space,omitempty"`
	App            string    `json:"app,omitempty"`
	Site           string    `json:"site,omitempty"`
	Created        time.Time `json:"created"`
	Updated        time.Time `json:"updated"`
	DestinationUrl string    `json:"url"`
}

func UnmarshalRoute

func UnmarshalRoute(route string) (Route, error)

func (*Route) GetRouteKey

func (rt *Route) GetRouteKey() string

func (*Route) GetRouteString

func (rt *Route) GetRouteString() string

type Storage

type Storage interface {
	HealthCheck() error
	Init(url string) error
	SetSession(key string, value LogSession, duration time.Duration) error
	GetSession(key string) (LogSession, error)
	GetRoutes() ([]Route, error)
	GetRouteById(id string) (*Route, error)
	RemoveRoute(route Route) error
	AddRoute(route Route) error
	AddRoutes([]Route) error
	Close()
}

Jump to

Keyboard shortcuts

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