Proto experimentation

This commit is contained in:
R. Tyler Croy 2014-07-12 15:45:33 -07:00
parent 42575f3055
commit e1935961b8
6 changed files with 64 additions and 11 deletions

View File

@ -4,6 +4,8 @@ require 'blick/emitter'
module Blick::Agent
module Observers
# The heartbeat observer is for indicating that this instance of the agent
# is operational and functioning properly.
class Heartbeat < Observer
#######################################################################
### Observer registry/internals
@ -33,6 +35,9 @@ module Blick::Agent
### Observer execution/runtime
#######################################################################
# Emit a {Blick::Events::Heartbeat} event to the bus
#
# @return [Boolean] Success of the +#emit+ operation
def execute
beat = Blick::Events::Heartbeat.new(:header => Blick::Events.header)
beat.observers = self.enabled_observers

View File

@ -2,6 +2,10 @@ require 'blick/agent/observer'
module Blick::Agent
module Observers
# The No-op observer is just a stub-class which exists to validate
# enabled/disabled behavior inside of Blick::Agent as it Observers go
#
# This class genuinely doesn't do anything
class Noop < Observer
#######################################################################
### Observer registry/internals
@ -30,6 +34,8 @@ module Blick::Agent
### Observer execution/runtime
#######################################################################
# @raise [StandardError] If for some reason execute on this disabled
# Observer is called
def execute
raise StandardError, "#{self.class.name} should never execute!"
end

View File

@ -39,10 +39,8 @@ module Blick
class Datapoint
required ::Blick::Events::Header, :header, 1
required :string, :name, 2
required :string, :value, 3
required ::Blick::Events::SourceTypes, :source_type, 4
required :string, :emitter, 5
required :bytes, :data, 2
required :string, :emitter, 3
end
end

38
lib/blick/runtime.pb.rb Normal file
View File

@ -0,0 +1,38 @@
##
# This file is auto-generated. DO NOT EDIT!
#
require 'protobuf/message'
##
# Imports
#
require 'events.pb'
module Blick
module Events
module Datapoints
##
# Message Classes
#
class RubyRuntime < ::Protobuf::Message; end
##
# Message Fields
#
class RubyRuntime
required ::Blick::Events::Header, :header, 1
required :string, :name, 2
required :string, :value, 3
required ::Blick::Events::SourceTypes, :source_type, 4
required :string, :emitter, 5
end
end
end
end

View File

@ -13,13 +13,9 @@ message Heartbeat {
}
message Datapoint {
required Header header = 1;
required string name = 2;
/* XXX: This will need to be refactored to support multiple datatypes */
required string value = 3;
/* perhaps using a `type` field which references an enum of other protobufs? */
required SourceTypes source_type = 4;
required string emitter = 5;
required Header header = 1;
required bytes data = 2;
required string emitter = 3;
}
/* SourceTypes are to indicate to the receiver of a Datapoint what kind of data

10
proto/runtime.proto Normal file
View File

@ -0,0 +1,10 @@
import 'events.proto';
package blick.events.datapoints;
message RubyRuntime {
required string name = 2;
/* XXX: This will need to be refactored to support multiple datatypes */
required string value = 3;
/* perhaps using a `type` field which references an enum of other protobufs? */
required SourceTypes source_type = 4;
}