geottnsvc

package
v0.0.0-...-75a2702 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MsgReceivedCounter = promauto.NewCounter(
		prometheus.CounterOpts{
			Namespace: "geottn",
			Name:      "received_msg_total",
			Help:      "The total number of received msg from TTN",
		},
	)

	ErrorCounter = promauto.NewCounter(
		prometheus.CounterOpts{
			Namespace: "geottn",
			Name:      "error_total",
			Help:      "The total number of errors occurring",
		},
	)

	InsertCounter = promauto.NewCounter(
		prometheus.CounterOpts{
			Namespace: "geottn",
			Name:      "insert_total",
			Help:      "The total number of inserts in db",
		},
	)
)

Functions

func RegisterGeoTTNServer

func RegisterGeoTTNServer(s *grpc.Server, srv GeoTTNServer)

Types

type Config

type Config struct {
	// the cayenne channel used for gps messages
	Channel int
}

type DataPoint

type DataPoint struct {
	AppId                string               `protobuf:"bytes,1,opt,name=app_id,json=appId,proto3" json:"app_id,omitempty"`
	DeviceId             string               `protobuf:"bytes,2,opt,name=device_id,json=deviceId,proto3" json:"device_id,omitempty"`
	Latitude             float64              `protobuf:"fixed64,3,opt,name=latitude,proto3" json:"latitude,omitempty"`
	Longitude            float64              `protobuf:"fixed64,4,opt,name=longitude,proto3" json:"longitude,omitempty"`
	Time                 *timestamp.Timestamp `protobuf:"bytes,5,opt,name=time,proto3" json:"time,omitempty"`
	Payload              []byte               `protobuf:"bytes,6,opt,name=payload,proto3" json:"payload,omitempty"`
	XXX_NoUnkeyedLiteral struct{}             `json:"-"`
	XXX_unrecognized     []byte               `json:"-"`
	XXX_sizecache        int32                `json:"-"`
}

func StorageToDataPoint

func StorageToDataPoint(dp *storage.DataPoint) *DataPoint

func (*DataPoint) Descriptor

func (*DataPoint) Descriptor() ([]byte, []int)

func (*DataPoint) GetAppId

func (m *DataPoint) GetAppId() string

func (*DataPoint) GetDeviceId

func (m *DataPoint) GetDeviceId() string

func (*DataPoint) GetLatitude

func (m *DataPoint) GetLatitude() float64

func (*DataPoint) GetLongitude

func (m *DataPoint) GetLongitude() float64

func (*DataPoint) GetPayload

func (m *DataPoint) GetPayload() []byte

func (*DataPoint) GetTime

func (m *DataPoint) GetTime() *timestamp.Timestamp

func (*DataPoint) ProtoMessage

func (*DataPoint) ProtoMessage()

func (*DataPoint) Reset

func (m *DataPoint) Reset()

func (*DataPoint) String

func (m *DataPoint) String() string

func (*DataPoint) XXX_DiscardUnknown

func (m *DataPoint) XXX_DiscardUnknown()

func (*DataPoint) XXX_Marshal

func (m *DataPoint) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DataPoint) XXX_Merge

func (dst *DataPoint) XXX_Merge(src proto.Message)

func (*DataPoint) XXX_Size

func (m *DataPoint) XXX_Size() int

func (*DataPoint) XXX_Unmarshal

func (m *DataPoint) XXX_Unmarshal(b []byte) error

type DataPoints

type DataPoints struct {
	Points               []*DataPoint `protobuf:"bytes,1,rep,name=points,proto3" json:"points,omitempty"`
	XXX_NoUnkeyedLiteral struct{}     `json:"-"`
	XXX_unrecognized     []byte       `json:"-"`
	XXX_sizecache        int32        `json:"-"`
}

func (*DataPoints) Descriptor

func (*DataPoints) Descriptor() ([]byte, []int)

func (*DataPoints) GetPoints

func (m *DataPoints) GetPoints() []*DataPoint

func (*DataPoints) ProtoMessage

func (*DataPoints) ProtoMessage()

func (*DataPoints) Reset

func (m *DataPoints) Reset()

func (*DataPoints) String

func (m *DataPoints) String() string

func (*DataPoints) XXX_DiscardUnknown

func (m *DataPoints) XXX_DiscardUnknown()

func (*DataPoints) XXX_Marshal

func (m *DataPoints) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*DataPoints) XXX_Merge

func (dst *DataPoints) XXX_Merge(src proto.Message)

func (*DataPoints) XXX_Size

func (m *DataPoints) XXX_Size() int

func (*DataPoints) XXX_Unmarshal

func (m *DataPoints) XXX_Unmarshal(b []byte) error

type GeoTTNClient

type GeoTTNClient interface {
	Store(ctx context.Context, in *DataPoint, opts ...grpc.CallOption) (*empty.Empty, error)
	RadiusSearch(ctx context.Context, in *RadiusSearchRequest, opts ...grpc.CallOption) (*DataPoints, error)
	RectSearch(ctx context.Context, in *RectSearchRequest, opts ...grpc.CallOption) (*DataPoints, error)
	Get(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*DataPoint, error)
	GetAll(ctx context.Context, in *GetRequest, opts ...grpc.CallOption) (*DataPoints, error)
	Keys(ctx context.Context, in *empty.Empty, opts ...grpc.CallOption) (*KeyList, error)
}

GeoTTNClient is the client API for GeoTTN service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewGeoTTNClient

func NewGeoTTNClient(cc *grpc.ClientConn) GeoTTNClient

type GeoTTNServer

GeoTTNServer is the server API for GeoTTN service.

type GetRequest

type GetRequest struct {
	Key                  string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*GetRequest) Descriptor

func (*GetRequest) Descriptor() ([]byte, []int)

func (*GetRequest) GetKey

func (m *GetRequest) GetKey() string

func (*GetRequest) ProtoMessage

func (*GetRequest) ProtoMessage()

func (*GetRequest) Reset

func (m *GetRequest) Reset()

func (*GetRequest) String

func (m *GetRequest) String() string

func (*GetRequest) XXX_DiscardUnknown

func (m *GetRequest) XXX_DiscardUnknown()

func (*GetRequest) XXX_Marshal

func (m *GetRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetRequest) XXX_Merge

func (dst *GetRequest) XXX_Merge(src proto.Message)

func (*GetRequest) XXX_Size

func (m *GetRequest) XXX_Size() int

func (*GetRequest) XXX_Unmarshal

func (m *GetRequest) XXX_Unmarshal(b []byte) error

type KeyList

type KeyList struct {
	Keys                 []string `protobuf:"bytes,1,rep,name=keys,proto3" json:"keys,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*KeyList) Descriptor

func (*KeyList) Descriptor() ([]byte, []int)

func (*KeyList) GetKeys

func (m *KeyList) GetKeys() []string

func (*KeyList) ProtoMessage

func (*KeyList) ProtoMessage()

func (*KeyList) Reset

func (m *KeyList) Reset()

func (*KeyList) String

func (m *KeyList) String() string

func (*KeyList) XXX_DiscardUnknown

func (m *KeyList) XXX_DiscardUnknown()

func (*KeyList) XXX_Marshal

func (m *KeyList) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*KeyList) XXX_Merge

func (dst *KeyList) XXX_Merge(src proto.Message)

func (*KeyList) XXX_Size

func (m *KeyList) XXX_Size() int

func (*KeyList) XXX_Unmarshal

func (m *KeyList) XXX_Unmarshal(b []byte) error

type RadiusSearchRequest

type RadiusSearchRequest struct {
	Lat float64 `protobuf:"fixed64,1,opt,name=lat,proto3" json:"lat,omitempty"`
	Lng float64 `protobuf:"fixed64,2,opt,name=lng,proto3" json:"lng,omitempty"`
	// radius in meters
	Radius               float64  `protobuf:"fixed64,3,opt,name=radius,proto3" json:"radius,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RadiusSearchRequest) Descriptor

func (*RadiusSearchRequest) Descriptor() ([]byte, []int)

func (*RadiusSearchRequest) GetLat

func (m *RadiusSearchRequest) GetLat() float64

func (*RadiusSearchRequest) GetLng

func (m *RadiusSearchRequest) GetLng() float64

func (*RadiusSearchRequest) GetRadius

func (m *RadiusSearchRequest) GetRadius() float64

func (*RadiusSearchRequest) ProtoMessage

func (*RadiusSearchRequest) ProtoMessage()

func (*RadiusSearchRequest) Reset

func (m *RadiusSearchRequest) Reset()

func (*RadiusSearchRequest) String

func (m *RadiusSearchRequest) String() string

func (*RadiusSearchRequest) XXX_DiscardUnknown

func (m *RadiusSearchRequest) XXX_DiscardUnknown()

func (*RadiusSearchRequest) XXX_Marshal

func (m *RadiusSearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RadiusSearchRequest) XXX_Merge

func (dst *RadiusSearchRequest) XXX_Merge(src proto.Message)

func (*RadiusSearchRequest) XXX_Size

func (m *RadiusSearchRequest) XXX_Size() int

func (*RadiusSearchRequest) XXX_Unmarshal

func (m *RadiusSearchRequest) XXX_Unmarshal(b []byte) error

type RectSearchRequest

type RectSearchRequest struct {
	Urlat                float64  `protobuf:"fixed64,1,opt,name=urlat,proto3" json:"urlat,omitempty"`
	Urlng                float64  `protobuf:"fixed64,2,opt,name=urlng,proto3" json:"urlng,omitempty"`
	Bllat                float64  `protobuf:"fixed64,3,opt,name=bllat,proto3" json:"bllat,omitempty"`
	Bllng                float64  `protobuf:"fixed64,4,opt,name=bllng,proto3" json:"bllng,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*RectSearchRequest) Descriptor

func (*RectSearchRequest) Descriptor() ([]byte, []int)

func (*RectSearchRequest) GetBllat

func (m *RectSearchRequest) GetBllat() float64

func (*RectSearchRequest) GetBllng

func (m *RectSearchRequest) GetBllng() float64

func (*RectSearchRequest) GetUrlat

func (m *RectSearchRequest) GetUrlat() float64

func (*RectSearchRequest) GetUrlng

func (m *RectSearchRequest) GetUrlng() float64

func (*RectSearchRequest) ProtoMessage

func (*RectSearchRequest) ProtoMessage()

func (*RectSearchRequest) Reset

func (m *RectSearchRequest) Reset()

func (*RectSearchRequest) String

func (m *RectSearchRequest) String() string

func (*RectSearchRequest) XXX_DiscardUnknown

func (m *RectSearchRequest) XXX_DiscardUnknown()

func (*RectSearchRequest) XXX_Marshal

func (m *RectSearchRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*RectSearchRequest) XXX_Merge

func (dst *RectSearchRequest) XXX_Merge(src proto.Message)

func (*RectSearchRequest) XXX_Size

func (m *RectSearchRequest) XXX_Size() int

func (*RectSearchRequest) XXX_Unmarshal

func (m *RectSearchRequest) XXX_Unmarshal(b []byte) error

type Server

type Server struct {
	Health *health.Server
	GeoDB  storage.Indexer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(appName string, logger log.Logger, idx storage.Indexer, cfg Config) *Server

func (*Server) Get

func (s *Server) Get(ctx context.Context, req *GetRequest) (*DataPoint, error)

func (*Server) GetAll

func (s *Server) GetAll(ctx context.Context, in *GetRequest) (*DataPoints, error)

func (*Server) HandleMessage

func (s *Server) HandleMessage(ctx context.Context, msg *types.UplinkMessage)

HandleMessage handles message from TTN

func (*Server) Keys

func (s *Server) Keys(context.Context, *empty.Empty) (*KeyList, error)

func (*Server) RadiusSearch

func (s *Server) RadiusSearch(ctx context.Context, req *RadiusSearchRequest) (*DataPoints, error)

func (*Server) RectSearch

func (s *Server) RectSearch(ctx context.Context, req *RectSearchRequest) (*DataPoints, error)

func (*Server) Store

func (s *Server) Store(ctx context.Context, dp *DataPoint) (*empty.Empty, error)

Jump to

Keyboard shortcuts

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