servers

package
v0.0.0-...-4faa3c3 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2017 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CtxIdentity represents an authenticated identity
	CtxIdentity types.CtxKey = "identity"

	// CtxTokenClaims represents claims in an auth token
	CtxTokenClaims types.CtxKey = "token_claims"

	// ErrInvalidToken represents a error about an invalid token
	ErrInvalidToken = fmt.Errorf("permission denied. Invalid token")
)
View Source
var (
	// MaxObjectPerPut is the maximum number of objects allowed in a single PUT operation
	MaxObjectPerPut = 25
)

Functions

This section is empty.

Types

type HTTP

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

HTTP defines a structure for an HTTP server that provides REST API services.

func NewHTTP

func NewHTTP(db patchain.DB, rpcServerAddr string) *HTTP

NewHTTP creates an new http server instance

func (*HTTP) Start

func (s *HTTP) Start(addr string, startedCB func(*HTTP)) error

Start starts the http server. Passes true to the startedCh channel when started

type RPC

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

RPC defines structure for the RPC server

func NewRPC

func NewRPC(db patchain.DB) *RPC

NewRPC creates a new RPC server

func (*RPC) CommitSession

func (s *RPC) CommitSession(ctx context.Context, req *proto_rpc.DBSession) (*proto_rpc.DBSession, error)

CommitSession commits an active session. Returns no error if the session was successfully committed, or has already been committed or does not exist.

func (*RPC) CountObjects

CountObjects counts the number of objects that match a query

func (*RPC) CreateDBSession

func (s *RPC) CreateDBSession(ctx context.Context, req *proto_rpc.DBSession) (*proto_rpc.DBSession, error)

CreateDBSession creates a new session and returns the session ID

func (*RPC) CreateIdentity

CreateIdentity creates a new identity for object

func (*RPC) CreateMapping

CreateMapping creates a mapping for an identity

func (*RPC) CreateObjects

CreateObjects creates one or more objects using a session. If session id is provide, it checks whether the session exists locally or forwards the request to the remote session host. Supports the use of mapping to unmap custom fields in the objects to be created.

func (*RPC) DeleteDBSession

func (s *RPC) DeleteDBSession(ctx context.Context, req *proto_rpc.DBSession) (*proto_rpc.DBSession, error)

DeleteDBSession deletes a existing database session

func (*RPC) GetAllMapping

GetAllMapping fetches the most recent mappings belonging to the logged in developer

func (*RPC) GetDBSession

func (s *RPC) GetDBSession(ctx context.Context, req *proto_rpc.DBSession) (*proto_rpc.DBSession, error)

GetDBSession gets a database session.

func (*RPC) GetIdentity

GetIdentity fetches an identity object

func (*RPC) GetMapping

GetMapping fetches a mapping belonging to the logged in developer

func (*RPC) GetObjects

GetObjects fetches objects belonging to an identity

func (*RPC) Interceptors

func (s *RPC) Interceptors() grpc.UnaryServerInterceptor

Interceptors returns the API interceptors

func (*RPC) RollbackSession

func (s *RPC) RollbackSession(ctx context.Context, req *proto_rpc.DBSession) (*proto_rpc.DBSession, error)

RollbackSession rolls back a session. Returns no error if the session was successfully rolled back, or has already been rolled back or does not exist.

func (*RPC) Start

func (s *RPC) Start(addr string, startedCB func(rpcServer *RPC)) error

Start starts the server. It will bind to the address provided

func (*RPC) Stop

func (s *RPC) Stop() error

Stop stops the RPC server and all other sub routines

Directories

Path Synopsis
Package proto_rpc is a generated protocol buffer package.
Package proto_rpc is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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