collector

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2019 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const ETCDDetectorsPrefix = "detectors"
View Source
const ETCDLinkPrefix = "links"

Variables

View Source
var DEVICE_name = map[int32]string{
	0: "DEVICE_UNKNOWN",
	1: "MOBILE",
	2: "WIFI",
	3: "BLUETOOTH",
}
View Source
var DEVICE_value = map[string]int32{
	"DEVICE_UNKNOWN": 0,
	"MOBILE":         1,
	"WIFI":           2,
	"BLUETOOTH":      3,
}

Functions

func EventKey added in v0.0.2

func EventKey(namespace, detectorID, deviceID string, timestamp time.Time) string

func RegisterCollectorServiceServer

func RegisterCollectorServiceServer(s *grpc.Server, srv CollectorServiceServer)

Types

type CollectorServiceClient

type CollectorServiceClient interface {
	CreateEventLog(ctx context.Context, in *EventLog, opts ...grpc.CallOption) (*empty.Empty, error)
	// NOTICE: not implemented
	CreateDetectorLink(ctx context.Context, in *DetectorLink, opts ...grpc.CallOption) (*empty.Empty, error)
	StreamEventLog(ctx context.Context, opts ...grpc.CallOption) (CollectorService_StreamEventLogClient, error)
	CreateCoordinates(ctx context.Context, in *Coordinates, opts ...grpc.CallOption) (*empty.Empty, error)
	CreateDetectorStatus(ctx context.Context, in *DetectorStatus, opts ...grpc.CallOption) (*empty.Empty, error)
}

CollectorServiceClient is the client API for CollectorService service.

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

func NewCollectorServiceClient

func NewCollectorServiceClient(cc *grpc.ClientConn) CollectorServiceClient

type CollectorServiceServer

type CollectorServiceServer interface {
	CreateEventLog(context.Context, *EventLog) (*empty.Empty, error)
	// NOTICE: not implemented
	CreateDetectorLink(context.Context, *DetectorLink) (*empty.Empty, error)
	StreamEventLog(CollectorService_StreamEventLogServer) error
	CreateCoordinates(context.Context, *Coordinates) (*empty.Empty, error)
	CreateDetectorStatus(context.Context, *DetectorStatus) (*empty.Empty, error)
}

CollectorServiceServer is the server API for CollectorService service.

func NewCollectorService

func NewCollectorService(repo Repository, logger log15.Logger) CollectorServiceServer

type CollectorService_StreamEventLogClient

type CollectorService_StreamEventLogClient interface {
	Send(*EventLog) error
	CloseAndRecv() (*SendStreamResponse, error)
	grpc.ClientStream
}

type CollectorService_StreamEventLogServer

type CollectorService_StreamEventLogServer interface {
	SendAndClose(*SendStreamResponse) error
	Recv() (*EventLog, error)
	grpc.ServerStream
}

type Coordinates

type Coordinates struct {
	DetectorId string `protobuf:"bytes,1,opt,name=detector_id,json=detectorId,proto3" json:"detector_id,omitempty"`
	// Since decimal is not supported. We use int64 scaled values with fixed 5 decimal places.
	// This means that 1 is equivalent to 0.00001 decimal degrees so ground precision is around 1.1132 m
	Latitude             int64    `protobuf:"varint,2,opt,name=latitude,proto3" json:"latitude,omitempty"`
	Longitude            int64    `protobuf:"varint,3,opt,name=longitude,proto3" json:"longitude,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Coordinates) Descriptor

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

func (*Coordinates) GetDetectorId

func (m *Coordinates) GetDetectorId() string

func (*Coordinates) GetLatitude

func (m *Coordinates) GetLatitude() int64

func (*Coordinates) GetLongitude

func (m *Coordinates) GetLongitude() int64

func (*Coordinates) ProtoMessage

func (*Coordinates) ProtoMessage()

func (*Coordinates) Reset

func (m *Coordinates) Reset()

func (*Coordinates) String

func (m *Coordinates) String() string

func (*Coordinates) XXX_DiscardUnknown

func (m *Coordinates) XXX_DiscardUnknown()

func (*Coordinates) XXX_Marshal

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

func (*Coordinates) XXX_Merge

func (m *Coordinates) XXX_Merge(src proto.Message)

func (*Coordinates) XXX_Size

func (m *Coordinates) XXX_Size() int

func (*Coordinates) XXX_Unmarshal

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

type DEVICE

type DEVICE int32
const (
	DEVICE_DEVICE_UNKNOWN DEVICE = 0
	DEVICE_MOBILE         DEVICE = 1
	DEVICE_WIFI           DEVICE = 2
	DEVICE_BLUETOOTH      DEVICE = 3
)

func (DEVICE) EnumDescriptor

func (DEVICE) EnumDescriptor() ([]byte, []int)

func (DEVICE) String

func (x DEVICE) String() string

type DetectionEvent

type DetectionEvent struct {
	Time []*timestamp.Timestamp `protobuf:"bytes,1,rep,name=time,proto3" json:"time,omitempty"`
	// Types that are valid to be assigned to DeviceId:
	//	*DetectionEvent_Wifi
	//	*DetectionEvent_Bluetooth
	//	*DetectionEvent_Mobile
	DeviceId             isDetectionEvent_DeviceId `protobuf_oneof:"device_id"`
	XXX_NoUnkeyedLiteral struct{}                  `json:"-"`
	XXX_unrecognized     []byte                    `json:"-"`
	XXX_sizecache        int32                     `json:"-"`
}

func (*DetectionEvent) Descriptor

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

func (*DetectionEvent) GetBluetooth

func (m *DetectionEvent) GetBluetooth() string

func (*DetectionEvent) GetDeviceId

func (m *DetectionEvent) GetDeviceId() isDetectionEvent_DeviceId

func (*DetectionEvent) GetMobile

func (m *DetectionEvent) GetMobile() string

func (*DetectionEvent) GetTime

func (m *DetectionEvent) GetTime() []*timestamp.Timestamp

func (*DetectionEvent) GetWifi

func (m *DetectionEvent) GetWifi() string

func (*DetectionEvent) ProtoMessage

func (*DetectionEvent) ProtoMessage()

func (*DetectionEvent) Reset

func (m *DetectionEvent) Reset()

func (*DetectionEvent) String

func (m *DetectionEvent) String() string

func (*DetectionEvent) XXX_DiscardUnknown

func (m *DetectionEvent) XXX_DiscardUnknown()

func (*DetectionEvent) XXX_Marshal

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

func (*DetectionEvent) XXX_Merge

func (m *DetectionEvent) XXX_Merge(src proto.Message)

func (*DetectionEvent) XXX_OneofWrappers

func (*DetectionEvent) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*DetectionEvent) XXX_Size

func (m *DetectionEvent) XXX_Size() int

func (*DetectionEvent) XXX_Unmarshal

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

type DetectionEvent_Bluetooth

type DetectionEvent_Bluetooth struct {
	Bluetooth string `protobuf:"bytes,3,opt,name=bluetooth,proto3,oneof"`
}

type DetectionEvent_Mobile

type DetectionEvent_Mobile struct {
	Mobile string `protobuf:"bytes,4,opt,name=mobile,proto3,oneof"`
}

type DetectionEvent_Wifi

type DetectionEvent_Wifi struct {
	Wifi string `protobuf:"bytes,2,opt,name=wifi,proto3,oneof"`
}
type DetectorLink struct {
	DestDetectorId       string                         `protobuf:"bytes,1,opt,name=dest_detector_id,json=destDetectorId,proto3" json:"dest_detector_id,omitempty"`
	SrcDetectors         []*DetectorLink_SourceDetector `protobuf:"bytes,2,rep,name=src_detectors,json=srcDetectors,proto3" json:"src_detectors,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                       `json:"-"`
	XXX_unrecognized     []byte                         `json:"-"`
	XXX_sizecache        int32                          `json:"-"`
}

func (*DetectorLink) Descriptor

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

func (*DetectorLink) GetDestDetectorId

func (m *DetectorLink) GetDestDetectorId() string

func (*DetectorLink) GetSrcDetectors

func (m *DetectorLink) GetSrcDetectors() []*DetectorLink_SourceDetector

func (*DetectorLink) ProtoMessage

func (*DetectorLink) ProtoMessage()

func (*DetectorLink) Reset

func (m *DetectorLink) Reset()

func (*DetectorLink) String

func (m *DetectorLink) String() string

func (*DetectorLink) XXX_DiscardUnknown

func (m *DetectorLink) XXX_DiscardUnknown()

func (*DetectorLink) XXX_Marshal

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

func (*DetectorLink) XXX_Merge

func (m *DetectorLink) XXX_Merge(src proto.Message)

func (*DetectorLink) XXX_Size

func (m *DetectorLink) XXX_Size() int

func (*DetectorLink) XXX_Unmarshal

func (m *DetectorLink) XXX_Unmarshal(b []byte) error
type DetectorLink_SourceDetector struct {
	DetectorId string `protobuf:"bytes,1,opt,name=detector_id,json=detectorId,proto3" json:"detector_id,omitempty"`
	// Maximum travel time from source detector to destination detector that is considered possible.
	MaxSeconds           int64    `protobuf:"varint,2,opt,name=max_seconds,json=maxSeconds,proto3" json:"max_seconds,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}
func (*DetectorLink_SourceDetector) Descriptor() ([]byte, []int)
func (m *DetectorLink_SourceDetector) GetDetectorId() string
func (m *DetectorLink_SourceDetector) GetMaxSeconds() int64
func (*DetectorLink_SourceDetector) ProtoMessage()
func (m *DetectorLink_SourceDetector) Reset()
func (m *DetectorLink_SourceDetector) String() string
func (m *DetectorLink_SourceDetector) XXX_DiscardUnknown()
func (m *DetectorLink_SourceDetector) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (m *DetectorLink_SourceDetector) XXX_Merge(src proto.Message)
func (m *DetectorLink_SourceDetector) XXX_Size() int
func (m *DetectorLink_SourceDetector) XXX_Unmarshal(b []byte) error

type DetectorStatus

type DetectorStatus struct {
	Loc                  *Coordinates    `protobuf:"bytes,1,opt,name=loc,proto3" json:"loc,omitempty"`
	ActiveDetectors      []DEVICE        `` /* 136-byte string literal not displayed */
	BatteryVoltage       float64         `protobuf:"fixed64,3,opt,name=battery_voltage,json=batteryVoltage,proto3" json:"battery_voltage,omitempty"`
	DetectionCount       map[int32]int64 `` /* 193-byte string literal not displayed */
	XXX_NoUnkeyedLiteral struct{}        `json:"-"`
	XXX_unrecognized     []byte          `json:"-"`
	XXX_sizecache        int32           `json:"-"`
}

func (*DetectorStatus) Descriptor

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

func (*DetectorStatus) GetActiveDetectors

func (m *DetectorStatus) GetActiveDetectors() []DEVICE

func (*DetectorStatus) GetBatteryVoltage

func (m *DetectorStatus) GetBatteryVoltage() float64

func (*DetectorStatus) GetDetectionCount

func (m *DetectorStatus) GetDetectionCount() map[int32]int64

func (*DetectorStatus) GetLoc

func (m *DetectorStatus) GetLoc() *Coordinates

func (*DetectorStatus) ProtoMessage

func (*DetectorStatus) ProtoMessage()

func (*DetectorStatus) Reset

func (m *DetectorStatus) Reset()

func (*DetectorStatus) String

func (m *DetectorStatus) String() string

func (*DetectorStatus) XXX_DiscardUnknown

func (m *DetectorStatus) XXX_DiscardUnknown()

func (*DetectorStatus) XXX_Marshal

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

func (*DetectorStatus) XXX_Merge

func (m *DetectorStatus) XXX_Merge(src proto.Message)

func (*DetectorStatus) XXX_Size

func (m *DetectorStatus) XXX_Size() int

func (*DetectorStatus) XXX_Unmarshal

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

type EventLog

type EventLog struct {
	Loc                  *Coordinates      `protobuf:"bytes,1,opt,name=loc,proto3" json:"loc,omitempty"`
	Events               []*DetectionEvent `protobuf:"bytes,20,rep,name=events,proto3" json:"events,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_unrecognized     []byte            `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (*EventLog) Descriptor

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

func (*EventLog) GetEvents

func (m *EventLog) GetEvents() []*DetectionEvent

func (*EventLog) GetLoc

func (m *EventLog) GetLoc() *Coordinates

func (*EventLog) ProtoMessage

func (*EventLog) ProtoMessage()

func (*EventLog) Reset

func (m *EventLog) Reset()

func (*EventLog) String

func (m *EventLog) String() string

func (*EventLog) XXX_DiscardUnknown

func (m *EventLog) XXX_DiscardUnknown()

func (*EventLog) XXX_Marshal

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

func (*EventLog) XXX_Merge

func (m *EventLog) XXX_Merge(src proto.Message)

func (*EventLog) XXX_Size

func (m *EventLog) XXX_Size() int

func (*EventLog) XXX_Unmarshal

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

type Repository

type Repository interface {
	CreateDetectionEvent(ctx context.Context, detectorID string, deviceID string, timestamp time.Time) error
	CreateDetectorLink(ctx context.Context, destDetectorID, srcDetectorID string, maxSeconds int64) error

	// NOTICE: not implemented
	CreateActiveDetectors(ctx context.Context, detectorID string, activeDetectors string, timestamp time.Time) error
	CreateBatteryVoltage(ctx context.Context, detectorID string, voltage float64, timestamp time.Time) error
	CreateDetectionCount(ctx context.Context, detectorID string, detectorType string, count int64, timestamp time.Time) error
	CreateCoordinates(ctx context.Context, detectorID string, latitude, longitude types.DecimalDegrees) error
}

func NewEtcdRepository

func NewEtcdRepository(prefix string, endpoints []string, logger log15.Logger) (Repository, error)

type SendStreamResponse

type SendStreamResponse struct {
	Mobile               int64    `protobuf:"varint,2,opt,name=mobile,proto3" json:"mobile,omitempty"`
	Bluetooth            int64    `protobuf:"varint,3,opt,name=bluetooth,proto3" json:"bluetooth,omitempty"`
	Wifi                 int64    `protobuf:"varint,4,opt,name=wifi,proto3" json:"wifi,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SendStreamResponse) Descriptor

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

func (*SendStreamResponse) GetBluetooth

func (m *SendStreamResponse) GetBluetooth() int64

func (*SendStreamResponse) GetMobile

func (m *SendStreamResponse) GetMobile() int64

func (*SendStreamResponse) GetWifi

func (m *SendStreamResponse) GetWifi() int64

func (*SendStreamResponse) ProtoMessage

func (*SendStreamResponse) ProtoMessage()

func (*SendStreamResponse) Reset

func (m *SendStreamResponse) Reset()

func (*SendStreamResponse) String

func (m *SendStreamResponse) String() string

func (*SendStreamResponse) XXX_DiscardUnknown

func (m *SendStreamResponse) XXX_DiscardUnknown()

func (*SendStreamResponse) XXX_Marshal

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

func (*SendStreamResponse) XXX_Merge

func (m *SendStreamResponse) XXX_Merge(src proto.Message)

func (*SendStreamResponse) XXX_Size

func (m *SendStreamResponse) XXX_Size() int

func (*SendStreamResponse) XXX_Unmarshal

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

type UnimplementedCollectorServiceServer

type UnimplementedCollectorServiceServer struct {
}

UnimplementedCollectorServiceServer can be embedded to have forward compatible implementations.

func (*UnimplementedCollectorServiceServer) CreateCoordinates

func (*UnimplementedCollectorServiceServer) CreateDetectorStatus

func (*UnimplementedCollectorServiceServer) CreateDetectorStatus(ctx context.Context, req *DetectorStatus) (*empty.Empty, error)

func (*UnimplementedCollectorServiceServer) CreateEventLog

func (*UnimplementedCollectorServiceServer) StreamEventLog

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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