Documentation ¶
Index ¶
- Variables
- func Delete(db gorp.SqlExecutor, s *sdk.Service) error
- func DoRequest(ctx context.Context, srvs []sdk.Service, method, path string, args []byte, ...) ([]byte, http.Header, int, error)
- func FindDeadServices(ctx context.Context, db gorp.SqlExecutor, t time.Duration) ([]sdk.Service, error)
- func GetCDNPublicHTTPAdress(ctx context.Context, db gorp.SqlExecutor) (string, error)
- func GetCDNPublicTCPAdress(ctx context.Context, db gorp.SqlExecutor) (string, bool, error)
- func Initialize(c context.Context, dbF *database.DBConnectionFactory, ...)
- func Insert(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
- func KillDeadServices(ctx context.Context, dbFunc func() *gorp.DbMap)
- func LoadAll(ctx context.Context, db gorp.SqlExecutor, opts ...LoadOptionFunc) ([]sdk.Service, error)
- func LoadAllByType(ctx context.Context, db gorp.SqlExecutor, typeService string, ...) ([]sdk.Service, error)
- func LoadByConsumerID(ctx context.Context, db gorp.SqlExecutor, consumerID string) (*sdk.Service, error)
- func LoadByID(ctx context.Context, db gorp.SqlExecutor, id int64) (*sdk.Service, error)
- func LoadByName(ctx context.Context, db gorp.SqlExecutor, name string, opts ...LoadOptionFunc) (*sdk.Service, error)
- func LoadByNameAndType(ctx context.Context, db gorp.SqlExecutor, name, stype string) (*sdk.Service, error)
- func PostBinary(ctx context.Context, srvs []sdk.Service, path string, r io.Reader, ...) (int, error)
- func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
- func UpdateLastHeartbeat(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
- func UpsertStatus(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s sdk.Service, ...) error
- type Client
- type LoadOptionFunc
- type MultiPartData
Constants ¶
This section is empty.
Variables ¶
var HTTPClient cdsclient.HTTPClient
HTTPClient will be set to a default httpclient if not set
var HTTPSigner *httpsig.Signer
HTTPSigner is used to sign requests based on the RFC draft specification https://tools.ietf.org/html/draft-cavage-http-signatures-06
var LoadOptions = struct { WithStatus LoadOptionFunc }{ WithStatus: loadServiceStatus, }
LoadOptions provides all options on service loads functions
var NewClient func([]sdk.Service) Client = NewDefaultClient
Functions ¶
func DoRequest ¶
func DoRequest(ctx context.Context, srvs []sdk.Service, method, path string, args []byte, mods ...cdsclient.RequestModifier) ([]byte, http.Header, int, error)
DoRequest performs an http request on a service
func FindDeadServices ¶
func FindDeadServices(ctx context.Context, db gorp.SqlExecutor, t time.Duration) ([]sdk.Service, error)
FindDeadServices returns services which haven't heart since th duration
func GetCDNPublicHTTPAdress ¶
func GetCDNPublicTCPAdress ¶
func Initialize ¶
func Initialize(c context.Context, dbF *database.DBConnectionFactory, goRoutines *sdk.GoRoutines)
Initialize the service package
func Insert ¶
func Insert(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
Insert a service in database.
func KillDeadServices ¶
KillDeadServices must be run as a goroutine. It Deletes all dead workers
func LoadAll ¶
func LoadAll(ctx context.Context, db gorp.SqlExecutor, opts ...LoadOptionFunc) ([]sdk.Service, error)
LoadAll returns all services in database.
func LoadAllByType ¶
func LoadAllByType(ctx context.Context, db gorp.SqlExecutor, typeService string, opts ...LoadOptionFunc) ([]sdk.Service, error)
LoadAllByType returns all services with given type.
func LoadByConsumerID ¶
func LoadByConsumerID(ctx context.Context, db gorp.SqlExecutor, consumerID string) (*sdk.Service, error)
LoadByConsumerID returns a service by its consumer id.
func LoadByName ¶
func LoadByName(ctx context.Context, db gorp.SqlExecutor, name string, opts ...LoadOptionFunc) (*sdk.Service, error)
LoadByName returns a service by its name.
func LoadByNameAndType ¶
func LoadByNameAndType(ctx context.Context, db gorp.SqlExecutor, name, stype string) (*sdk.Service, error)
LoadByNameAndType returns a service by its name and type.
func PostBinary ¶
func PostBinary(ctx context.Context, srvs []sdk.Service, path string, r io.Reader, out interface{}, mods ...cdsclient.RequestModifier) (int, error)
PostBinary
func Update ¶
func Update(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
Update a service in database.
func UpdateLastHeartbeat ¶ added in v0.52.0
func UpdateLastHeartbeat(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s *sdk.Service) error
UpdateLastHeartbeat a service in database.
func UpsertStatus ¶
func UpsertStatus(ctx context.Context, db gorpmapper.SqlExecutorWithTx, s sdk.Service, authSessionID string) error
UpsertStatus insert or update monitoring status
Types ¶
type Client ¶
type Client interface { // DoJSONRequest performs an http request on a service DoJSONRequest(ctx context.Context, method, path string, in interface{}, out interface{}, mods ...cdsclient.RequestModifier) (http.Header, int, error) // DoMultiPartRequest performs an http request on a service with multipart tar file + json field DoMultiPartRequest(ctx context.Context, method, path string, multiPartData *MultiPartData, in interface{}, out interface{}, mods ...cdsclient.RequestModifier) (int, error) // StreamRequest performs an hhtp request and stream the response StreamRequest(ctx context.Context, method, path string, in interface{}, mods ...cdsclient.RequestModifier) (io.Reader, http.Header, int, error) }
func NewDefaultClient ¶
type LoadOptionFunc ¶
LoadOptionFunc is used as options to load services
type MultiPartData ¶
MultiPartData represents the data to send
Directories ¶
Path | Synopsis |
---|---|
Package mock_services is a generated GoMock package.
|
Package mock_services is a generated GoMock package. |