Documentation ¶
Index ¶
- Constants
- Variables
- func CanCall(caller, callee *DirectoryEntry, method string) bool
- func GetPeerGroups(entry *DirectoryEntry) []string
- func SetLogFormat(format string, service string) error
- type Address
- type BaseChannel
- func (b *BaseChannel) Directory() Directory
- func (b *BaseChannel) DirectoryEntry(operator string, channel string) (*DirectoryEntry, error)
- func (b *BaseChannel) MessageBroker() MessageBroker
- func (b *BaseChannel) OperatorEntry(name string) (*DirectoryEntry, error)
- func (b *BaseChannel) SetDirectory(directory Directory) error
- func (b *BaseChannel) SetMessageBroker(broker MessageBroker) error
- type BaseDirectory
- type BasicMessageBroker
- type ChangeRecord
- type Channel
- type ChannelDefinition
- type ChannelDefinitions
- type ChannelMaker
- type ChannelSettings
- type ClientInfo
- type CommandsDefinition
- type CommandsDefinitions
- type CommandsMaker
- type ConnectionRequest
- type DataEntry
- type Datastore
- type DatastoreDefinition
- type DatastoreDefinitions
- type DatastoreMaker
- type DatastoreSettings
- type Definitions
- type Directory
- type DirectoryDefinition
- type DirectoryDefinitions
- type DirectoryEntries
- type DirectoryEntry
- type DirectoryMaker
- type DirectoryQuery
- type DirectorySettings
- type Error
- type HashableTime
- type IRISFormatter
- type Level
- type Logger
- func (l *Logger) Debug(args ...interface{})
- func (l *Logger) Debugf(format string, args ...interface{})
- func (l *Logger) Error(args ...interface{})
- func (l *Logger) Errorf(format string, args ...interface{})
- func (l *Logger) Fatal(args ...interface{})
- func (l *Logger) Fatalf(format string, args ...interface{})
- func (l *Logger) Info(args ...interface{})
- func (l *Logger) Infof(format string, args ...interface{})
- func (l *Logger) SetLevel(level Level)
- func (l *Logger) Trace(args ...interface{})
- func (l *Logger) Tracef(format string, args ...interface{})
- func (l *Logger) Warning(args ...interface{})
- func (l *Logger) Warningf(format string, args ...interface{})
- type MessageBroker
- type MetricsSettings
- type OperatorCertificate
- type OperatorChannel
- type OperatorPreferences
- type OperatorProperties
- type OperatorService
- type OperatorSettings
- type Permission
- type ProxyChannel
- type Request
- type Response
- type ServiceMethod
- type ServiceParameter
- type ServiceValidator
- type Settings
- type SettingsValidator
- type Signature
- type SignedChangeRecord
- type SignedData
- type SigningSettings
- type WritableDirectory
Constants ¶
const ( PanicLogLevel = Level(log.PanicLevel) FatalLogLevel = Level(log.FatalLevel) ErrorLogLevel = Level(log.ErrorLevel) WarnLogLevel = Level(log.WarnLevel) InfoLogLevel = Level(log.InfoLevel) DebugLogLevel = Level(log.DebugLevel) TraceLogLevel = Level(log.TraceLevel) )
const (
NullType = 0
)
Variables ¶
var DirectoryQueryForm = forms.Form{ Fields: []forms.Field{ { Name: "group", Validators: []forms.Validator{ forms.IsOptional{}, forms.IsString{}, }, }, { Name: "operator", Validators: []forms.Validator{ forms.IsOptional{}, forms.IsString{}, }, }, { Name: "channels", Validators: []forms.Validator{ forms.IsOptional{}, forms.IsStringList{}, }, }, }, }
var IDAddressRegexp = regexp.MustCompile(`(?i)^(.*)\.([^\(\.]+)\(([^\)]+)\)$`)
var Log = Logger{}
var MethodNameRegexp = regexp.MustCompile(`(?i)^(.*)\.(.*)$`)
var NoEntryFound = fmt.Errorf("no directory entry found")
var Version = "development"
this variable gets updated using the build process
Functions ¶
func CanCall ¶
func CanCall(caller, callee *DirectoryEntry, method string) bool
func GetPeerGroups ¶
func GetPeerGroups(entry *DirectoryEntry) []string
get all groups that may call service methods of this entry
func SetLogFormat ¶
Types ¶
type Address ¶
type Address struct { Operator string `json:"operator"` Method string `json:"method"` ID string `json:"id"` }
func GetAddress ¶
type BaseChannel ¶
type BaseChannel struct {
// contains filtered or unexported fields
}
func (*BaseChannel) Directory ¶
func (b *BaseChannel) Directory() Directory
func (*BaseChannel) DirectoryEntry ¶
func (b *BaseChannel) DirectoryEntry(operator string, channel string) (*DirectoryEntry, error)
func (*BaseChannel) MessageBroker ¶
func (b *BaseChannel) MessageBroker() MessageBroker
func (*BaseChannel) OperatorEntry ¶
func (b *BaseChannel) OperatorEntry(name string) (*DirectoryEntry, error)
func (*BaseChannel) SetDirectory ¶
func (b *BaseChannel) SetDirectory(directory Directory) error
func (*BaseChannel) SetMessageBroker ¶
func (b *BaseChannel) SetMessageBroker(broker MessageBroker) error
type BaseDirectory ¶
type BaseDirectory struct {
Name_ string
}
func (*BaseDirectory) Name ¶
func (b *BaseDirectory) Name() string
type BasicMessageBroker ¶
type BasicMessageBroker struct {
// contains filtered or unexported fields
}
func MakeBasicMessageBroker ¶
func MakeBasicMessageBroker(directory Directory) (*BasicMessageBroker, error)
func (*BasicMessageBroker) AddChannel ¶
func (b *BasicMessageBroker) AddChannel(channel Channel) error
func (*BasicMessageBroker) Channels ¶
func (b *BasicMessageBroker) Channels() []Channel
func (*BasicMessageBroker) DeliverRequest ¶
func (b *BasicMessageBroker) DeliverRequest(request *Request, clientInfo *ClientInfo) (*Response, error)
type ChangeRecord ¶
type ChangeRecord struct { Name string `json:"name"` Section string `json:"section"` Data interface{} `json:"data"` CreatedAt HashableTime `json:"created_at"` }
describes a change in a specific section of the service directory
type Channel ¶
type Channel interface { Type() string MessageBroker() MessageBroker SetMessageBroker(MessageBroker) error CanDeliverTo(*Address) bool DeliverRequest(*Request) (*Response, error) SetDirectory(Directory) error Directory() Directory Close() error Open() error }
A channel can deliver and accept message
type ChannelDefinition ¶
type ChannelDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker ChannelMaker `json:"-"` SettingsValidator SettingsValidator `json:"-"` }
type ChannelDefinitions ¶
type ChannelDefinitions map[string]ChannelDefinition
type ChannelMaker ¶
type ChannelSettings ¶
type ClientInfo ¶
type ClientInfo struct { Name string `json:"name"` Entry *DirectoryEntry `json:"entry"` }
func (*ClientInfo) AsStruct ¶
func (c *ClientInfo) AsStruct() (map[string]interface{}, error)
for inclusion in protobuf... A bit dirty as we use JSON here, but it works...
type CommandsDefinition ¶
type CommandsDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker CommandsMaker `json:"-"` }
type CommandsDefinitions ¶
type CommandsDefinitions []CommandsDefinition
type ConnectionRequest ¶
type ConnectionRequest struct { Endpoint string `json:"endpoint"` Channel string `json:"channel"` Token []byte `json:"token"` Client *ClientInfo `json:"client"` }
type DatastoreDefinition ¶
type DatastoreDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker DatastoreMaker `json:"-"` SettingsValidator SettingsValidator `json:"-"` }
type DatastoreDefinitions ¶
type DatastoreDefinitions map[string]DatastoreDefinition
type DatastoreMaker ¶
type DatastoreSettings ¶
type DatastoreSettings struct { Type string `json:"type"` Settings interface{} `json:"settings"` }
type Definitions ¶
type Definitions struct { DirectoryDefinitions DatastoreDefinitions CommandsDefinitions ChannelDefinitions }
func MergeDefinitions ¶
func MergeDefinitions(a, b Definitions) Definitions
func (Definitions) Marshal ¶
func (d Definitions) Marshal() map[string]interface{}
func (Definitions) MarshalJSON ¶
func (d Definitions) MarshalJSON() ([]byte, error)
We perform JSON marshalling manually to gain more flexibility...
type Directory ¶
type Directory interface { Entries(*DirectoryQuery) ([]*DirectoryEntry, error) EntryFor(string) (*DirectoryEntry, error) OwnEntry() (*DirectoryEntry, error) Name() string }
A directory can deliver and accept message
type DirectoryDefinition ¶
type DirectoryDefinition struct { Name string `json:"name"` Description string `json:"description"` Maker DirectoryMaker `json:"-"` SettingsValidator SettingsValidator `json:"-"` }
type DirectoryDefinitions ¶
type DirectoryDefinitions map[string]DirectoryDefinition
type DirectoryEntries ¶
type DirectoryEntries []*DirectoryEntry
type DirectoryEntry ¶
type DirectoryEntry struct { Name string `json:"name"` Groups []string `json:"groups"` Channels []*OperatorChannel `json:"channels"` Services []*OperatorService `json:"services"` Certificates []*OperatorCertificate `json:"certificates"` Settings []*OperatorSettings `json:"settings"` Preferences []*OperatorPreferences `json:"preferences"` Records []*SignedChangeRecord `json:"records"` Properties *OperatorProperties `json:"properties"` }
func FilterDirectoryEntriesByQuery ¶
func FilterDirectoryEntriesByQuery(entries []*DirectoryEntry, query *DirectoryQuery) []*DirectoryEntry
helper function that can be used by directory implementations that have a list of local directory entries
func GetPeers ¶
func GetPeers(baseEntry *DirectoryEntry, entries []*DirectoryEntry, incomingOnly bool) []*DirectoryEntry
Return all entries that are relevant for the given base entry (i.e. that can call a service on the base entrys' endpoint or can be called by the base entrys' endpoint, respectively)
func MakeDirectoryEntry ¶
func MakeDirectoryEntry() *DirectoryEntry
func (*DirectoryEntry) Channel ¶
func (d *DirectoryEntry) Channel(channelType string) *OperatorChannel
func (*DirectoryEntry) SettingsFor ¶
func (d *DirectoryEntry) SettingsFor(service, operator string) *OperatorSettings
type DirectoryMaker ¶
type DirectoryQuery ¶
type DirectorySettings ¶
type DirectorySettings struct { Type string `json:"type"` Settings interface{} `json:"settings"` }
type HashableTime ¶
func (HashableTime) HashValue ¶
func (h HashableTime) HashValue() interface{}
type IRISFormatter ¶
type IRISFormatter struct {
// contains filtered or unexported fields
}
type MessageBroker ¶
type MetricsSettings ¶
type MetricsSettings struct {
BindAddress string `json:"bind_address"`
}
type OperatorCertificate ¶
type OperatorChannel ¶
type OperatorPreferences ¶
type OperatorPreferences struct { Operator string `json:"operator"` Service string `json:"service"` Environment string `json:"environment"` Preferences map[string]interface{} `json:"preferences"` }
preferences may be set by the corresponding operator itself
type OperatorProperties ¶
type OperatorProperties struct {
DisplayName string `json:"displayName"`
}
type OperatorService ¶
type OperatorService struct { Name string `json:"name"` Permissions []*Permission `json:"permissions"` Methods []*ServiceMethod `json:"methods"` }
func ServiceFor ¶
func ServiceFor(entry *DirectoryEntry, method string) *OperatorService
type OperatorSettings ¶
type OperatorSettings struct { Operator string `json:"operator"` Service string `json:"service"` Environment string `json:"environment"` Settings map[string]interface{} `json:"settings"` }
settings may only be set by a directory admin
type Permission ¶
type ProxyChannel ¶
type Response ¶
type Response struct { Result map[string]interface{} `json:"result,omitempty"` Error *Error `json:"error,omitempty"` ID *string `json:"id"` }
func ChannelError ¶
type ServiceMethod ¶
type ServiceMethod struct { Name string `json:"name"` Permissions []*Permission `json:"permissions"` Parameters []*ServiceParameter `json:"parameters"` }
type ServiceParameter ¶
type ServiceParameter struct { Name string `json:"name"` Validators []*ServiceValidator `json:"validators"` }
type ServiceValidator ¶
type Settings ¶
type Settings struct { Signing *SigningSettings `json:"signing"` Definitions *Definitions `json:"definitions"` Channels []*ChannelSettings `json:"channels"` Directory *DirectorySettings `json:"directory"` Metrics *MetricsSettings `json:"metrics"` Name string `json:"name"` }
type SettingsValidator ¶
type SignedChangeRecord ¶
type SignedChangeRecord struct { ParentHash string `json:"parent_hash"` Hash string `json:"hash"` Signature *Signature `json:"signature"` Record *ChangeRecord `json:"record"` }
type SignedData ¶
type SignedData struct { Signature *Signature `json:"signature"` Data interface{} `json:"data"` }
type SigningSettings ¶
type WritableDirectory ¶
type WritableDirectory interface { Directory // required for submitting change records Tip() (*SignedChangeRecord, error) Submit([]*SignedChangeRecord) error }