Documentation ¶
Index ¶
- Variables
- func NewDialogHandler(sessionManagerFactory ManagerFactory) *handler
- func NewManager(currentProposal discovery_dto.ServiceProposal, idGenerator IDGenerator, ...) *manager
- func RequestSessionCreate(sender communication.Sender, proposalID int, sessionPtr *Session) error
- type ConfigProvider
- type CreateRequest
- type CreateResponse
- type ID
- type IDGenerator
- type Manager
- type ManagerFactory
- type PromiseProcessor
- type SaveCallback
- type ServiceConfiguration
- type Session
- type SessionDto
- type StorageMemory
Constants ¶
This section is empty.
Variables ¶
var ( // ErrorInvalidProposal is validation error then invalid proposal requested for session creation ErrorInvalidProposal = errors.New("proposal does not exist") )
Functions ¶
func NewDialogHandler ¶
func NewDialogHandler(sessionManagerFactory ManagerFactory) *handler
NewDialogHandler constructs handler which gets all incoming dialogs and starts handling them
func NewManager ¶
func NewManager( currentProposal discovery_dto.ServiceProposal, idGenerator IDGenerator, configProvider ConfigProvider, saveCallback SaveCallback, promiseProcessor PromiseProcessor, ) *manager
NewManager returns new session manager
func RequestSessionCreate ¶
func RequestSessionCreate(sender communication.Sender, proposalID int, sessionPtr *Session) error
RequestSessionCreate requests session creation and returns session DTO
Types ¶
type ConfigProvider ¶
type ConfigProvider func() (ServiceConfiguration, error)
ConfigProvider provides session config for remote client
type CreateRequest ¶
type CreateRequest struct {
ProposalId int `json:"proposal_id"`
}
CreateRequest structure represents message from service consumer to initiate session for given proposal id
type CreateResponse ¶
type CreateResponse struct { Success bool `json:"success"` Message string `json:"message"` Session SessionDto `json:"session"` }
CreateResponse structure represents service provider response to given session request from consumer
type ID ¶
type ID string
ID represents session id type
func GenerateUUID ¶
GenerateUUID method returns ID based on random UUID, or error if we fail to generate one
type IDGenerator ¶
IDGenerator defines method for session id generation
type ManagerFactory ¶
type ManagerFactory func(dialog communication.Dialog) Manager
ManagerFactory initiates session manager instance during runtime
type PromiseProcessor ¶
type PromiseProcessor interface { Start(discovery_dto.ServiceProposal) error Stop() error }
PromiseProcessor processes promises at provider side. Provider checks promises from consumer and signs them also. Provider clears promises from consumer.
type ServiceConfiguration ¶
type ServiceConfiguration interface{}
ServiceConfiguration defines service configuration from underlying transport mechanism to be passed to remote party should be serializable to json format
type Session ¶
type Session struct { ID ID Config ServiceConfiguration ConsumerID identity.Identity }
Session structure holds all required information about current session between service consumer and provider
type SessionDto ¶
type SessionDto struct { ID ID `json:"id"` Config json.RawMessage `json:"config"` }
SessionDto structure represents session information data within session creation response (session id and configuration options for underlaying service type)
type StorageMemory ¶
type StorageMemory struct {
// contains filtered or unexported fields
}
StorageMemory maintains a map of session id -> session
func NewStorageMemory ¶
func NewStorageMemory() *StorageMemory
NewStorageMemory initiates new session storage
func (*StorageMemory) Add ¶
func (storage *StorageMemory) Add(sessionInstance Session)
Add puts given session to storage. Multiple sessions per peerID is possible in case different services are used
func (*StorageMemory) Find ¶
func (storage *StorageMemory) Find(id ID) (Session, bool)
Find returns underlying session instance
func (*StorageMemory) Remove ¶
func (storage *StorageMemory) Remove(id ID)
Remove removes given session from underlying storage