service

package
v0.0.0-...-3f0ed3f Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	Id string `param:"id"`
	// Acl is present for backwards compatability, and should not be written to.
	// Instead, write to the "Acl" key in Config
	Acl    string            `param:"acl"`
	Config map[string]string `param:"config"`
}

type ServiceRepr

type ServiceRepr interface {
	Service() Service
	Serialize() ([]byte, error)
}

func ParseServiceRepr

func ParseServiceRepr(body []byte, path string) (repr ServiceRepr, err error)

ParseServiceRepr attempts parse using each of the ReprParsers in turn. Returns the first result to not error, or the error from the last parser

func ParseV1ServiceRepr

func ParseV1ServiceRepr(body []byte, path string) (repr ServiceRepr, err error)

func ParseV2ServiceRepr

func ParseV2ServiceRepr(body []byte, path string) (ServiceRepr, error)

type Storage

type Storage interface {
	All() ([]Service, error)
	Upsert(service Service) error
	Delete(serviceId string) error
}

The storage primitives required by Bamboo from the storage backend

type V1ServiceRepr

type V1ServiceRepr struct {
	ID  string
	Acl string
}

func (*V1ServiceRepr) Serialize

func (v1 *V1ServiceRepr) Serialize() ([]byte, error)

func (*V1ServiceRepr) Service

func (v1 *V1ServiceRepr) Service() Service

type V2ServiceRepr

type V2ServiceRepr struct {
	ID      string            `json:"-"`
	Version string            `json:"version"` // 2 is only valid version for V2ServiceRepr
	Config  map[string]string `json:"config"`
}

func MakeV2ServiceRepr

func MakeV2ServiceRepr(service Service) *V2ServiceRepr

func NewV2ServiceRepr

func NewV2ServiceRepr(appID string, config map[string]string) *V2ServiceRepr

func (*V2ServiceRepr) Serialize

func (v2 *V2ServiceRepr) Serialize() ([]byte, error)

func (*V2ServiceRepr) Service

func (v2 *V2ServiceRepr) Service() Service

type ZKStorage

type ZKStorage struct {
	// contains filtered or unexported fields
}

func NewZKStorage

func NewZKStorage(conn *zk.Conn, conf conf.Zookeeper) (s *ZKStorage, err error)

func (*ZKStorage) All

func (z *ZKStorage) All() (services []Service, err error)

func (*ZKStorage) Delete

func (z *ZKStorage) Delete(serviceId string) error

func (*ZKStorage) Upsert

func (z *ZKStorage) Upsert(service Service) (err error)

Jump to

Keyboard shortcuts

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