servers

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2022 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Encode

func Encode(data []byte) string

in principle JSON will encode binary data as base64, but we do the conversion explicitly just to avoid any potential inconsistencies that might arise in the future...

func EncodeSlice

func EncodeSlice(data [][]byte) []string

in principle JSON will encode binary data as base64, but we do the conversion explicitly just to avoid any potential inconsistencies that might arise in the future...

func LockError

func LockError(context services.Context) services.Response

func SignedAppointment

func SignedAppointment(validateSettings *services.ValidateSettings, data []byte) (*services.SignedAppointment, error)

func SignedProviderData

func SignedProviderData(data []byte) (*services.SignedProviderData, error)

Types

type AppointmentDatesByID

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

func (*AppointmentDatesByID) Del

func (a *AppointmentDatesByID) Del(id []byte) error

func (*AppointmentDatesByID) Get

func (a *AppointmentDatesByID) Get(id []byte) (string, error)

func (*AppointmentDatesByID) GetAll

func (a *AppointmentDatesByID) GetAll() (map[string][]byte, error)

func (*AppointmentDatesByID) Set

func (a *AppointmentDatesByID) Set(id []byte, date string) error

type AppointmentDatesByProperty

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

func (*AppointmentDatesByProperty) Del

func (a *AppointmentDatesByProperty) Del(id []byte) error

func (*AppointmentDatesByProperty) Get

func (a *AppointmentDatesByProperty) Get(id []byte) (string, error)

func (*AppointmentDatesByProperty) GetAll

func (a *AppointmentDatesByProperty) GetAll() (map[string][]byte, error)

func (*AppointmentDatesByProperty) Set

func (a *AppointmentDatesByProperty) Set(appId []byte, date string) error

type Appointments

type Appointments struct {
	*Server
	// contains filtered or unexported fields
}

func MakeAppointments

func MakeAppointments(settings *services.Settings) (*Appointments, error)

func (*Appointments) Key

func (c *Appointments) Key(key string) *crypto.Key

func (*Appointments) LockAppointment

func (c *Appointments) LockAppointment(
	appointmentId []byte,
) (services.Lock, error)

appointment locks prevent concurrent changes in the appointment data (like bookings) which may lead to race conditions resulting in bookings getting lost

func (*Appointments) LockProvider

func (c *Appointments) LockProvider(
	providerId []byte,
) (services.Lock, error)

provider locks prohibit the provider and mediator to change data concurrently which may lead to inconsisten data

func (*Appointments) LockToken

func (c *Appointments) LockToken(
	token []byte,
) (services.Lock, error)

token locks prevent double spending of tokens

func (*Appointments) LockUser

func (c *Appointments) LockUser(
	userId []byte,
) (services.Lock, error)

user lock prevents race conditions when checking the token limit per user

type AppointmentsBackend

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

The appointments backend acts as an interface between the API and the database. It is mostly concerned with ensuring data is propery serialized and deserialized when stored or fetched from the database.

func (*AppointmentsBackend) AppointmentDatesByID

func (a *AppointmentsBackend) AppointmentDatesByID(providerID []byte) *AppointmentDatesByID

func (*AppointmentsBackend) AppointmentDatesByProperty

func (a *AppointmentsBackend) AppointmentDatesByProperty(
	providerID []byte,
	key string,
	value string,
) *AppointmentDatesByProperty

func (*AppointmentsBackend) AppointmentsByDate

func (a *AppointmentsBackend) AppointmentsByDate(
	providerID []byte,
	date string,
) *AppointmentsByDate

func (*AppointmentsBackend) Codes

func (a *AppointmentsBackend) Codes(actor string) *Codes

func (*AppointmentsBackend) ConfirmedProviderData

func (a *AppointmentsBackend) ConfirmedProviderData() *ConfirmedProviderData

func (*AppointmentsBackend) Keys

func (a *AppointmentsBackend) Keys(actor string) *Keys

func (*AppointmentsBackend) Neighbors

func (a *AppointmentsBackend) Neighbors(neighborType, zipCode string) *Neighbors

func (*AppointmentsBackend) PriorityToken

func (a *AppointmentsBackend) PriorityToken(name string) *PriorityToken

func (*AppointmentsBackend) ProviderStatus added in v0.8.1

func (a *AppointmentsBackend) ProviderStatus() *ProviderStatus

func (*AppointmentsBackend) PublicProviderData

func (a *AppointmentsBackend) PublicProviderData() *PublicProviderData

func (*AppointmentsBackend) UnverifiedProviderData

func (a *AppointmentsBackend) UnverifiedProviderData() *RawProviderData

func (*AppointmentsBackend) UsedTokens

func (a *AppointmentsBackend) UsedTokens() *UsedTokens

func (*AppointmentsBackend) VerifiedProviderData

func (a *AppointmentsBackend) VerifiedProviderData() *RawProviderData

type AppointmentsByDate

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

func (*AppointmentsByDate) Del

func (a *AppointmentsByDate) Del(id []byte) error

func (*AppointmentsByDate) Get

func (a *AppointmentsByDate) Get(validateSettings *services.ValidateSettings, id []byte) (*services.SignedAppointment, error)

func (*AppointmentsByDate) GetAll

func (a *AppointmentsByDate) GetAll(validateSettings *services.ValidateSettings) (map[string]*services.SignedAppointment, error)

func (*AppointmentsByDate) Set

func (a *AppointmentsByDate) Set(appointment *services.SignedAppointment) error

type Codes

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

func (*Codes) Add

func (c *Codes) Add(code []byte) error

func (*Codes) AddToScore

func (c *Codes) AddToScore(code []byte, score int64) error

func (*Codes) Del

func (c *Codes) Del(code []byte) error

func (*Codes) Has

func (c *Codes) Has(code []byte) (bool, error)

func (*Codes) Score

func (c *Codes) Score(code []byte) (int64, error)

type ConfirmedProviderData

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

func (*ConfirmedProviderData) Get

func (c *ConfirmedProviderData) Get(providerID []byte) (*services.ConfirmedProviderData, error)

func (*ConfirmedProviderData) Set

func (c *ConfirmedProviderData) Set(providerID []byte, encryptedData *services.ConfirmedProviderData) error

type Keys

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

func (*Keys) Get

func (k *Keys) Get(id []byte) (*services.ActorKey, error)

func (*Keys) GetAll

func (k *Keys) GetAll() ([]*services.ActorKey, error)

func (*Keys) Set

func (k *Keys) Set(id []byte, key *services.ActorKey) error

type Neighbors

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

func (*Neighbors) Add

func (n *Neighbors) Add(to string, distance int64) error

func (*Neighbors) Range

func (n *Neighbors) Range(from, to int64) ([]*services.SortedSetEntry, error)

type PriorityToken

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

func (*PriorityToken) DecrBy

func (p *PriorityToken) DecrBy(value int64) (int64, error)

func (*PriorityToken) IncrBy

func (p *PriorityToken) IncrBy(value int64) (int64, error)

type ProviderStatus added in v0.8.1

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

func (*ProviderStatus) Get added in v0.8.1

func (p *ProviderStatus) Get(id []byte) (string, error)

func (*ProviderStatus) Set added in v0.8.1

func (p *ProviderStatus) Set(id []byte, data string) error

type PublicProviderData

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

func (*PublicProviderData) Get

func (p *PublicProviderData) Get(id []byte) (*services.SignedProviderData, error)

func (*PublicProviderData) Set

func (p *PublicProviderData) Set(id []byte, signedProviderData *services.SignedProviderData) error

type RawProviderData

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

func (*RawProviderData) Del

func (c *RawProviderData) Del(providerID []byte) error

func (*RawProviderData) Get

func (c *RawProviderData) Get(providerID []byte) (*services.RawProviderData, error)

func (*RawProviderData) GetAll

func (c *RawProviderData) GetAll() (map[string]*services.RawProviderData, error)

func (*RawProviderData) Set

func (c *RawProviderData) Set(providerID []byte, rawData *services.RawProviderData) error

type Server

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

func MakeServer

func MakeServer(
	name string,
	httpSettings *services.HTTPServerSettings,
	jsonRPCSettings *services.JSONRPCServerSettings,
	restSettings *services.RESTServerSettings,
	validateSettings *services.ValidateSettings,
	api *api.API) (*Server, error)

func (*Server) Start

func (c *Server) Start() error

func (*Server) Stop

func (c *Server) Stop() error

type Storage

type Storage struct {
	*Server
	// contains filtered or unexported fields
}

func MakeStorage

func MakeStorage(settings *services.Settings) (*Storage, error)

type UsedTokens

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

func (*UsedTokens) Add

func (t *UsedTokens) Add(token []byte) error

func (*UsedTokens) Del

func (t *UsedTokens) Del(token []byte) error

func (*UsedTokens) Has

func (t *UsedTokens) Has(token []byte) (bool, error)

type Values

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

func (Values) Len

func (f Values) Len() int

func (Values) Less

func (f Values) Less(i, j int) bool

func (Values) Swap

func (f Values) Swap(i, j int)

Jump to

Keyboard shortcuts

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