grpc

package
v0.0.0-...-bb13912 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2017 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotFound is returned when the specified resource was not found.
	ErrNotFound = errors.New("the specified resource was not found or insufficient permissions")
	// ErrValidation is returned when the model/parameters validation failed.
	ErrValidation = errors.New("the request validation failed")
)

Functions

This section is empty.

Types

type Endpoints

type Endpoints struct {
	CreateSessionEndpoint              endpoint.Endpoint
	FindSessionByTokenEndpoint         endpoint.Endpoint
	DeleteSessionByTokenEndpoint       endpoint.Endpoint
	DeleteSessionsByOwnerTokenEndpoint endpoint.Endpoint
}

Endpoints collects all of the endpoints that compose a session management service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func (Endpoints) CreateSession

func (e Endpoints) CreateSession(ctx context.Context, session *pb.Session) (*pb.Session, error)

CreateSession implements Service.

func (Endpoints) DeleteSessionByToken

func (e Endpoints) DeleteSessionByToken(ctx context.Context, token string) (*pb.Session, error)

DeleteSessionByToken implements Service.

func (Endpoints) DeleteSessionsByOwnerToken

func (e Endpoints) DeleteSessionsByOwnerToken(ctx context.Context, ownerToken string) ([]*pb.Session, error)

DeleteSessionsByOwnerToken implements Service.

func (Endpoints) FindSessionByToken

func (e Endpoints) FindSessionByToken(ctx context.Context, token string) (*pb.Session, error)

FindSessionByToken implements Service.

type Option

type Option func(*options)

Option sets an optional parameter for the gRPC client.

func LimiterCapacity

func LimiterCapacity(capacity int64) Option

LimiterCapacity sets the capacity of the limiter bucket (tokens/sec).

func LimiterRate

func LimiterRate(rate float64) Option

LimiterRate sets the filling rate of the limiter bucket (tokens/sec).

type Service

type Service interface {
	CreateSession(ctx context.Context, session *pb.Session) (*pb.Session, error)
	FindSessionByToken(ctx context.Context, token string) (*pb.Session, error)
	DeleteSessionByToken(ctx context.Context, token string) (*pb.Session, error)
	DeleteSessionsByOwnerToken(ctx context.Context, ownerToken string) ([]*pb.Session, error)
}

Service represents the session management service interface.

func New

func New(conn *grpc.ClientConn, tracer stdopentracing.Tracer, logger log.Logger, opts ...Option) Service

New returns a session management service backed by a gRPC client connection. It is the responsibility of the caller to dial, and later close, the connection.

Jump to

Keyboard shortcuts

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