Documentation ¶
Overview ¶
Package discovery is a generated protocol buffer package.
It is generated from these files:
github.com/TheThingsNetwork/ttn/api/discovery/discovery.proto
It has these top-level messages:
Metadata Announcement GetAllRequest GetRequest MetadataRequest AnnouncementsResponse
Index ¶
- Variables
- func RegisterDiscoveryManagerServer(s *grpc.Server, srv DiscoveryManagerServer)
- func RegisterDiscoveryServer(s *grpc.Server, srv DiscoveryServer)
- type Announcement
- func (announcement *Announcement) AddMetadata(key Metadata_Key, value []byte)
- func (announcement *Announcement) DeleteMetadata(key Metadata_Key, value []byte)
- func (*Announcement) Descriptor() ([]byte, []int)
- func (a *Announcement) Dial() (*grpc.ClientConn, error)
- func (announcement *Announcement) FromStringStringMap(input map[string]string) error
- func (m *Announcement) GetMetadata() []*Metadata
- func (m *Announcement) Marshal() (dAtA []byte, err error)
- func (m *Announcement) MarshalTo(dAtA []byte) (int, error)
- func (*Announcement) ProtoMessage()
- func (m *Announcement) Reset()
- func (m *Announcement) Size() (n int)
- func (m *Announcement) String() string
- func (announcement *Announcement) ToStringStringMap(properties ...string) (map[string]string, error)
- func (m *Announcement) Unmarshal(dAtA []byte) error
- func (m *Announcement) Validate() error
- type AnnouncementsResponse
- func (*AnnouncementsResponse) Descriptor() ([]byte, []int)
- func (m *AnnouncementsResponse) GetServices() []*Announcement
- func (m *AnnouncementsResponse) Marshal() (dAtA []byte, err error)
- func (m *AnnouncementsResponse) MarshalTo(dAtA []byte) (int, error)
- func (*AnnouncementsResponse) ProtoMessage()
- func (m *AnnouncementsResponse) Reset()
- func (m *AnnouncementsResponse) Size() (n int)
- func (m *AnnouncementsResponse) String() string
- func (m *AnnouncementsResponse) Unmarshal(dAtA []byte) error
- type Client
- type DefaultClient
- func (c *DefaultClient) AddMetadata(key Metadata_Key, value []byte, token string) error
- func (c *DefaultClient) Announce(token string) error
- func (c *DefaultClient) Close() error
- func (c *DefaultClient) DeleteMetadata(key Metadata_Key, value []byte, token string) error
- func (c *DefaultClient) Get(serviceName, id string) (*Announcement, error)
- func (c *DefaultClient) GetAll(serviceName string) ([]*Announcement, error)
- func (c *DefaultClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*Announcement, error)
- func (c *DefaultClient) GetAllForMetadata(serviceName string, key Metadata_Key, matchFunc func(value []byte) bool) ([]*Announcement, error)
- func (c *DefaultClient) GetAllHandlersForAppID(appID string) ([]*Announcement, error)
- type DiscoveryClient
- type DiscoveryManagerClient
- type DiscoveryManagerServer
- type DiscoveryServer
- type GetAllRequest
- func (*GetAllRequest) Descriptor() ([]byte, []int)
- func (m *GetAllRequest) Marshal() (dAtA []byte, err error)
- func (m *GetAllRequest) MarshalTo(dAtA []byte) (int, error)
- func (*GetAllRequest) ProtoMessage()
- func (m *GetAllRequest) Reset()
- func (m *GetAllRequest) Size() (n int)
- func (m *GetAllRequest) String() string
- func (m *GetAllRequest) Unmarshal(dAtA []byte) error
- type GetRequest
- func (*GetRequest) Descriptor() ([]byte, []int)
- func (m *GetRequest) Marshal() (dAtA []byte, err error)
- func (m *GetRequest) MarshalTo(dAtA []byte) (int, error)
- func (*GetRequest) ProtoMessage()
- func (m *GetRequest) Reset()
- func (m *GetRequest) Size() (n int)
- func (m *GetRequest) String() string
- func (m *GetRequest) Unmarshal(dAtA []byte) error
- type Metadata
- func (*Metadata) Descriptor() ([]byte, []int)
- func (m *Metadata) Marshal() (dAtA []byte, err error)
- func (m *Metadata) MarshalTo(dAtA []byte) (int, error)
- func (*Metadata) ProtoMessage()
- func (m *Metadata) Reset()
- func (m *Metadata) Size() (n int)
- func (m *Metadata) String() string
- func (m *Metadata) Unmarshal(dAtA []byte) error
- type MetadataRequest
- func (*MetadataRequest) Descriptor() ([]byte, []int)
- func (m *MetadataRequest) GetMetadata() *Metadata
- func (m *MetadataRequest) Marshal() (dAtA []byte, err error)
- func (m *MetadataRequest) MarshalTo(dAtA []byte) (int, error)
- func (*MetadataRequest) ProtoMessage()
- func (m *MetadataRequest) Reset()
- func (m *MetadataRequest) Size() (n int)
- func (m *MetadataRequest) String() string
- func (m *MetadataRequest) Unmarshal(dAtA []byte) error
- type Metadata_Key
- type MockClient
- func (_m *MockClient) AddMetadata(key Metadata_Key, value []byte, token string) error
- func (_m *MockClient) Announce(token string) error
- func (_m *MockClient) Close() error
- func (_m *MockClient) DeleteMetadata(key Metadata_Key, value []byte, token string) error
- func (_m *MockClient) EXPECT() *_MockClientRecorder
- func (_m *MockClient) Get(serviceName string, id string) (*Announcement, error)
- func (_m *MockClient) GetAll(serviceName string) ([]*Announcement, error)
- func (_m *MockClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*Announcement, error)
- func (_m *MockClient) GetAllForMetadata(serviceName string, key Metadata_Key, matchFunc func([]byte) bool) ([]*Announcement, error)
- func (_m *MockClient) GetAllHandlersForAppID(appID string) ([]*Announcement, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLengthDiscovery = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowDiscovery = fmt.Errorf("proto: integer overflow") )
var AnnouncementProperties = []string{
"id",
"description",
"service_name",
"service_version",
"net_address",
"public_key",
"certificate",
"metadata",
}
AnnouncementProperties contains all properties of an Announcement that can be stored in Redis.
var CacheExpiration = 5 * time.Minute
CacheExpiration indicates the time a cached item is valid
var CacheSize = 1000
CacheSize indicates the number of components that are cached
var Metadata_Key_name = map[int32]string{
0: "OTHER",
1: "PREFIX",
2: "APP_EUI",
3: "APP_ID",
}
var Metadata_Key_value = map[string]int32{
"OTHER": 0,
"PREFIX": 1,
"APP_EUI": 2,
"APP_ID": 3,
}
Functions ¶
func RegisterDiscoveryManagerServer ¶
func RegisterDiscoveryManagerServer(s *grpc.Server, srv DiscoveryManagerServer)
func RegisterDiscoveryServer ¶
func RegisterDiscoveryServer(s *grpc.Server, srv DiscoveryServer)
Types ¶
type Announcement ¶
type Announcement struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` ServiceVersion string `protobuf:"bytes,3,opt,name=service_version,json=serviceVersion,proto3" json:"service_version,omitempty"` Description string `protobuf:"bytes,4,opt,name=description,proto3" json:"description,omitempty"` Url string `protobuf:"bytes,5,opt,name=url,proto3" json:"url,omitempty"` Public bool `protobuf:"varint,6,opt,name=public,proto3" json:"public,omitempty"` NetAddress string `protobuf:"bytes,11,opt,name=net_address,json=netAddress,proto3" json:"net_address,omitempty"` PublicKey string `protobuf:"bytes,12,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` Certificate string `protobuf:"bytes,13,opt,name=certificate,proto3" json:"certificate,omitempty"` Metadata []*Metadata `protobuf:"bytes,21,rep,name=metadata" json:"metadata,omitempty"` }
func (*Announcement) AddMetadata ¶
func (announcement *Announcement) AddMetadata(key Metadata_Key, value []byte)
AddMetadata adds metadata to the announcement if it doesn't exist
func (*Announcement) DeleteMetadata ¶
func (announcement *Announcement) DeleteMetadata(key Metadata_Key, value []byte)
DeleteMetadata deletes metadata from the announcement if it exists
func (*Announcement) Descriptor ¶
func (*Announcement) Descriptor() ([]byte, []int)
func (*Announcement) Dial ¶
func (a *Announcement) Dial() (*grpc.ClientConn, error)
Dial dials the component represented by this Announcement
func (*Announcement) FromStringStringMap ¶
func (announcement *Announcement) FromStringStringMap(input map[string]string) error
FromStringStringMap imports known values from the input to a Status.
func (*Announcement) GetMetadata ¶
func (m *Announcement) GetMetadata() []*Metadata
func (*Announcement) Marshal ¶
func (m *Announcement) Marshal() (dAtA []byte, err error)
func (*Announcement) ProtoMessage ¶
func (*Announcement) ProtoMessage()
func (*Announcement) Reset ¶
func (m *Announcement) Reset()
func (*Announcement) Size ¶
func (m *Announcement) Size() (n int)
func (*Announcement) String ¶
func (m *Announcement) String() string
func (*Announcement) ToStringStringMap ¶
func (announcement *Announcement) ToStringStringMap(properties ...string) (map[string]string, error)
ToStringStringMap converts the given properties of Announcement to a map[string]string for storage in Redis.
func (*Announcement) Unmarshal ¶
func (m *Announcement) Unmarshal(dAtA []byte) error
func (*Announcement) Validate ¶
func (m *Announcement) Validate() error
Validate implements the api.Validator interface
type AnnouncementsResponse ¶
type AnnouncementsResponse struct {
Services []*Announcement `protobuf:"bytes,1,rep,name=services" json:"services,omitempty"`
}
func (*AnnouncementsResponse) Descriptor ¶
func (*AnnouncementsResponse) Descriptor() ([]byte, []int)
func (*AnnouncementsResponse) GetServices ¶
func (m *AnnouncementsResponse) GetServices() []*Announcement
func (*AnnouncementsResponse) Marshal ¶
func (m *AnnouncementsResponse) Marshal() (dAtA []byte, err error)
func (*AnnouncementsResponse) MarshalTo ¶
func (m *AnnouncementsResponse) MarshalTo(dAtA []byte) (int, error)
func (*AnnouncementsResponse) ProtoMessage ¶
func (*AnnouncementsResponse) ProtoMessage()
func (*AnnouncementsResponse) Reset ¶
func (m *AnnouncementsResponse) Reset()
func (*AnnouncementsResponse) Size ¶
func (m *AnnouncementsResponse) Size() (n int)
func (*AnnouncementsResponse) String ¶
func (m *AnnouncementsResponse) String() string
func (*AnnouncementsResponse) Unmarshal ¶
func (m *AnnouncementsResponse) Unmarshal(dAtA []byte) error
type Client ¶
type Client interface { Announce(token string) error GetAll(serviceName string) ([]*Announcement, error) Get(serviceName, id string) (*Announcement, error) AddMetadata(key Metadata_Key, value []byte, token string) error DeleteMetadata(key Metadata_Key, value []byte, token string) error GetAllForMetadata(serviceName string, key Metadata_Key, matchFunc func(value []byte) bool) ([]*Announcement, error) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*Announcement, error) GetAllHandlersForAppID(appID string) ([]*Announcement, error) Close() error }
Client is used as the main client to the Discovery server
type DefaultClient ¶
DefaultClient is a wrapper around DiscoveryClient
func (*DefaultClient) AddMetadata ¶
func (c *DefaultClient) AddMetadata(key Metadata_Key, value []byte, token string) error
AddMetadata publishes metadata for the current component to the Discovery server
func (*DefaultClient) Announce ¶
func (c *DefaultClient) Announce(token string) error
Announce announces the configured announcement to the discovery server
func (*DefaultClient) Close ¶
func (c *DefaultClient) Close() error
Close purges the cache and closes the connection with the Discovery server
func (*DefaultClient) DeleteMetadata ¶
func (c *DefaultClient) DeleteMetadata(key Metadata_Key, value []byte, token string) error
DeleteMetadata deletes metadata for the current component from the Discovery server
func (*DefaultClient) Get ¶
func (c *DefaultClient) Get(serviceName, id string) (*Announcement, error)
Get returns the (cached) service annoucement for the given service type and id
func (*DefaultClient) GetAll ¶
func (c *DefaultClient) GetAll(serviceName string) ([]*Announcement, error)
GetAll returns all services of the given service type
func (*DefaultClient) GetAllBrokersForDevAddr ¶
func (c *DefaultClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*Announcement, error)
GetAllBrokersForDevAddr returns all brokers that can handle the given DevAddr
func (*DefaultClient) GetAllForMetadata ¶
func (c *DefaultClient) GetAllForMetadata(serviceName string, key Metadata_Key, matchFunc func(value []byte) bool) ([]*Announcement, error)
GetAllForMetadata returns all annoucements of given type that contain given metadata and match the given function
func (*DefaultClient) GetAllHandlersForAppID ¶
func (c *DefaultClient) GetAllHandlersForAppID(appID string) ([]*Announcement, error)
GetAllHandlersForAppID returns all handlers that can handle the given AppID
type DiscoveryClient ¶
type DiscoveryClient interface { Announce(ctx context.Context, in *Announcement, opts ...grpc.CallOption) (*google_protobuf.Empty, error) GetAll(ctx context.Context, in *GetAllRequest, opts ...grpc.CallOption) (*AnnouncementsResponse, error) Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*Announcement, error) AddMetadata(ctx context.Context, in *MetadataRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) DeleteMetadata(ctx context.Context, in *MetadataRequest, opts ...grpc.CallOption) (*google_protobuf.Empty, error) }
func NewDiscoveryClient ¶
func NewDiscoveryClient(cc *grpc.ClientConn) DiscoveryClient
type DiscoveryManagerClient ¶
type DiscoveryManagerClient interface { }
func NewDiscoveryManagerClient ¶
func NewDiscoveryManagerClient(cc *grpc.ClientConn) DiscoveryManagerClient
type DiscoveryManagerServer ¶
type DiscoveryManagerServer interface { }
type DiscoveryServer ¶
type DiscoveryServer interface { Announce(context.Context, *Announcement) (*google_protobuf.Empty, error) GetAll(context.Context, *GetAllRequest) (*AnnouncementsResponse, error) Get(context.Context, *GetRequest) (*Announcement, error) AddMetadata(context.Context, *MetadataRequest) (*google_protobuf.Empty, error) DeleteMetadata(context.Context, *MetadataRequest) (*google_protobuf.Empty, error) }
type GetAllRequest ¶
type GetAllRequest struct {
ServiceName string `protobuf:"bytes,1,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"`
}
func (*GetAllRequest) Descriptor ¶
func (*GetAllRequest) Descriptor() ([]byte, []int)
func (*GetAllRequest) Marshal ¶
func (m *GetAllRequest) Marshal() (dAtA []byte, err error)
func (*GetAllRequest) ProtoMessage ¶
func (*GetAllRequest) ProtoMessage()
func (*GetAllRequest) Reset ¶
func (m *GetAllRequest) Reset()
func (*GetAllRequest) Size ¶
func (m *GetAllRequest) Size() (n int)
func (*GetAllRequest) String ¶
func (m *GetAllRequest) String() string
func (*GetAllRequest) Unmarshal ¶
func (m *GetAllRequest) Unmarshal(dAtA []byte) error
type GetRequest ¶
type GetRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` }
func (*GetRequest) Descriptor ¶
func (*GetRequest) Descriptor() ([]byte, []int)
func (*GetRequest) Marshal ¶
func (m *GetRequest) Marshal() (dAtA []byte, err error)
func (*GetRequest) ProtoMessage ¶
func (*GetRequest) ProtoMessage()
func (*GetRequest) Reset ¶
func (m *GetRequest) Reset()
func (*GetRequest) Size ¶
func (m *GetRequest) Size() (n int)
func (*GetRequest) String ¶
func (m *GetRequest) String() string
func (*GetRequest) Unmarshal ¶
func (m *GetRequest) Unmarshal(dAtA []byte) error
type Metadata ¶
type Metadata struct { Key Metadata_Key `protobuf:"varint,1,opt,name=key,proto3,enum=discovery.Metadata_Key" json:"key,omitempty"` Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` }
func (*Metadata) Descriptor ¶
func (*Metadata) ProtoMessage ¶
func (*Metadata) ProtoMessage()
type MetadataRequest ¶
type MetadataRequest struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` ServiceName string `protobuf:"bytes,2,opt,name=service_name,json=serviceName,proto3" json:"service_name,omitempty"` Metadata *Metadata `protobuf:"bytes,11,opt,name=metadata" json:"metadata,omitempty"` }
func (*MetadataRequest) Descriptor ¶
func (*MetadataRequest) Descriptor() ([]byte, []int)
func (*MetadataRequest) GetMetadata ¶
func (m *MetadataRequest) GetMetadata() *Metadata
func (*MetadataRequest) Marshal ¶
func (m *MetadataRequest) Marshal() (dAtA []byte, err error)
func (*MetadataRequest) ProtoMessage ¶
func (*MetadataRequest) ProtoMessage()
func (*MetadataRequest) Reset ¶
func (m *MetadataRequest) Reset()
func (*MetadataRequest) Size ¶
func (m *MetadataRequest) Size() (n int)
func (*MetadataRequest) String ¶
func (m *MetadataRequest) String() string
func (*MetadataRequest) Unmarshal ¶
func (m *MetadataRequest) Unmarshal(dAtA []byte) error
type Metadata_Key ¶
type Metadata_Key int32
const ( Metadata_OTHER Metadata_Key = 0 // The value for PREFIX consists of 1 byte denoting the number of bits, // followed by the prefix and enough trailing bits to fill 4 octets Metadata_PREFIX Metadata_Key = 1 // APP_EUI is used for announcing join handlers. // The value for APP_EUI is the byte slice of the AppEUI string Metadata_APP_EUI Metadata_Key = 2 // APP_ID is used for announcing regular handlers // The value for APP_ID is the byte slice of the AppID string Metadata_APP_ID Metadata_Key = 3 )
func (Metadata_Key) EnumDescriptor ¶
func (Metadata_Key) EnumDescriptor() ([]byte, []int)
func (Metadata_Key) String ¶
func (x Metadata_Key) String() string
type MockClient ¶
type MockClient struct {
// contains filtered or unexported fields
}
Mock of Client interface
func NewMockClient ¶
func NewMockClient(ctrl *gomock.Controller) *MockClient
func (*MockClient) AddMetadata ¶
func (_m *MockClient) AddMetadata(key Metadata_Key, value []byte, token string) error
func (*MockClient) Announce ¶
func (_m *MockClient) Announce(token string) error
func (*MockClient) Close ¶
func (_m *MockClient) Close() error
func (*MockClient) DeleteMetadata ¶
func (_m *MockClient) DeleteMetadata(key Metadata_Key, value []byte, token string) error
func (*MockClient) EXPECT ¶
func (_m *MockClient) EXPECT() *_MockClientRecorder
func (*MockClient) Get ¶
func (_m *MockClient) Get(serviceName string, id string) (*Announcement, error)
func (*MockClient) GetAll ¶
func (_m *MockClient) GetAll(serviceName string) ([]*Announcement, error)
func (*MockClient) GetAllBrokersForDevAddr ¶
func (_m *MockClient) GetAllBrokersForDevAddr(devAddr types.DevAddr) ([]*Announcement, error)
func (*MockClient) GetAllForMetadata ¶
func (_m *MockClient) GetAllForMetadata(serviceName string, key Metadata_Key, matchFunc func([]byte) bool) ([]*Announcement, error)
func (*MockClient) GetAllHandlersForAppID ¶
func (_m *MockClient) GetAllHandlersForAppID(appID string) ([]*Announcement, error)