service

package
v0.0.0-...-51d629d Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2016 License: BSD-3-Clause, BSD-3-Clause Imports: 12 Imported by: 0

README


All REQUESTS:

The following must always be included:

id=     Identity of the caller's unique identifier
date=   date/time stamp when the call was issued. This is formatted in RFC1123 format
ver=1   This is required.

Documentation

Index

Constants

View Source
const (
	SERVICE_EMPTY_BODY = ""

	PERMIT_ALL      = "permit_all"
	PERMIT_LOGIN    = "permit_login"
	PERMIT_PASSWORD = "permit_password"
	PERMIT_NAME     = "permit_name"
	PERMIT_EMAIL    = "permit_email"
)

Permissions for updating

Variables

This section is empty.

Functions

This section is empty.

Types

type ServiceCreator

type ServiceCreator func() *ServiceProcess

Service creator is any function that returns a pointer to a ServiceProcess.

type ServiceProcess

type ServiceProcess struct {
	// Points to the function that will process the request. It will be passed this structure.
	Run func(*ServiceProcess) (record.Packer, error)

	// Point to the configuration class. All configuration is held here.
	Config *configure.Configure

	// The request head is the unpacked header that was decoded from the incoming
	// request package.
	RequestHead *head.Head
	// The request body, unpacked for the service record
	RequestBody record.BodyInterface
	// Client record making the request. This can come from the user or client database
	Client *tenant.User

	// Header for response we are sending back.
	ResponseHead *head.Head
	// Record package - this is what will be returned from any of the calls.
	ResponsePackage record.Packer

	// Datastore for user records. The clientstore, if separate, is not stored as it is
	// only needed once to access the client record.
	UserStore storage.Storer

	// Options can be used to set any options that are desired for the routines.
	Options map[string]string

	SetFlag bool
}

All of the service control requirements are stored in this structure. This points to the runtime function that will receive this information.

func NewServiceAuthenticate

func NewServiceAuthenticate() *ServiceProcess

The Structure that gives us the entry point for user record updates

func NewServiceLogin

func NewServiceLogin() *ServiceProcess

The Structure that gives us the entry point for user Login

func NewServiceLogout

func NewServiceLogout() *ServiceProcess

The Structure that gives us the entry point for user Logout

func NewServiceRegister

func NewServiceRegister() *ServiceProcess

func NewServiceTest

func NewServiceTest() *ServiceProcess

NewServiceTest is the entry point for a client checking a connection

func NewServiceUpdate

func NewServiceUpdate() *ServiceProcess

The Structure that gives us the entry point for user record updates

func (*ServiceProcess) PackageCodeMsg

func (s *ServiceProcess) PackageCodeMsg(code int, msg string) (record.Packer, error)

PackageCodeMsg will create a general error for GUS from an integer code and string passed.

func (*ServiceProcess) PackageErr

func (s *ServiceProcess) PackageErr(err error) (record.Packer, error)

PackageErr will encode the error as a general error, set the error type in the header as 'Error' serialise it in JSON format and package up the response.

func (*ServiceProcess) PackageOk

func (s *ServiceProcess) PackageOk() (record.Packer, error)

Return an OK package value. The package is signed, but no data is serialised.

func (*ServiceProcess) Reset

func (s *ServiceProcess) Reset() *ServiceProcess

Allocate storage for all of the data in the structure. This will "reset" the storage and let the service be re-used.

func (*ServiceProcess) SetupService

func (s *ServiceProcess) SetupService(c *configure.Configure, requestPackage string) (record.Packer, error)

Setup the service structure for common values required. This will take the request package and unpack it into the header and service-specific body.

func (*ServiceProcess) Teardown

func (s *ServiceProcess) Teardown() error

Perform any cleanup needed, closing any connections.

type ServiceProcessor

type ServiceProcessor interface {
	Setup(*configure.Configure, string) *record.Package
	Teardown() error
	GeneralError(string, error) *record.Package
	Response(string, error) *record.Package
}

Directories

Path Synopsis
Package web is the interface between HTTP/HTTPS calls and the service layer.
Package web is the interface between HTTP/HTTPS calls and the service layer.

Jump to

Keyboard shortcuts

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