Documentation ¶
Index ¶
- Variables
- func MakeDeleteLeaseClientEndpoint(s Service) endpoint.Endpoint
- func MakeDeleteLeaseDistccEndpoint(s Service) endpoint.Endpoint
- func MakeHTTPHandler(s Service, logger log.Logger) http.Handler
- func MakePutLeaseClientEndpoint(s Service) endpoint.Endpoint
- func MakePutLeaseDistccEndpoint(s Service) endpoint.Endpoint
- type ClientLease
- type DistccLease
- type Endpoints
- type Middleware
- type Service
Constants ¶
This section is empty.
Variables ¶
var ( // ErrCanceled is used when the request cannot be satisfied on time ErrCanceled = errors.New("timeout or canceled") // ErrNotFound is used when the given resource was not found ErrNotFound = errors.New("resource not found") )
var ( // ErrBadRouting is returned when an expected path variable is missing. // It always indicates programmer error. ErrBadRouting = errors.New("inconsistent mapping between route and handler (programmer error)") )
Functions ¶
func MakeDeleteLeaseClientEndpoint ¶
MakeDeleteLeaseClientEndpoint creates an endpoint for the DeleteClient service
func MakeDeleteLeaseDistccEndpoint ¶
MakeDeleteLeaseDistccEndpoint creates an endpoint for the DeleteDistcc service
func MakeHTTPHandler ¶
MakeHTTPHandler mounts all of the service endpoints into an http.Handler.
func MakePutLeaseClientEndpoint ¶
MakePutLeaseClientEndpoint creates an endpoint for the LeaseDistccClient service
func MakePutLeaseDistccEndpoint ¶
MakePutLeaseDistccEndpoint creates an endpoint for the LeaseDistcc service
Types ¶
type ClientLease ¶
type ClientLease struct { // Expiration is the time at which the lease will end. Expiration time.Time `json:"expiration"` // NodePort is the port allocated for the service. // // The service will be accessible from any host with an external // interface running on the cluster. NodePort int `json:"nodePort,omitempty"` }
ClientLease contains info about a lease for a specific user and tag.
type DistccLease ¶
type DistccLease struct { // Expiration is the time at which the lease will end. Expiration time.Time `json:"expiration"` // Endpoints is the list of hosts that can be used to access the resoure // being leased. Endpoints []string `json:"endpoints,omitempty"` // Replicas is the number of replicas sitting behind the endpoints. // // This might be useful to determine the number of replicas behind the // given endpoints. Replicas int `json:"replicas,omitempty"` }
DistccLease contains info about a lease for a specific user and tag.
type Endpoints ¶
type Endpoints struct { PutLeaseDistccEndpoint endpoint.Endpoint DeleteLeaseDistccEndpoint endpoint.Endpoint PutLeaseClientEndpoint endpoint.Endpoint DeleteLeaseClientEndpoint endpoint.Endpoint }
Endpoints collects all the api endpoints in a single struct
func MakeEndpoints ¶
MakeEndpoints creates the api endpoints, wiring in the given service
type Middleware ¶
Middleware describes a service (as opposed to endpoint) middleware.
func LoggingMiddleware ¶
func LoggingMiddleware(logger log.Logger) Middleware
LoggingMiddleware implements a service with logging
type Service ¶
type Service interface { LeaseDistcc(ctx context.Context, u data.User, t data.Tag) (DistccLease, error) DeleteDistcc(ctx context.Context, u data.User, t data.Tag) error LeaseClient(ctx context.Context, u data.User, t data.Tag) (ClientLease, error) DeleteClient(ctx context.Context, u data.User, t data.Tag) error }
Service is an interface that implements all the APIs.
func NewService ¶
func NewService(sharedclient *controller.SharedClient, logger log.Logger) Service
NewService creates the API service