import "github.com/leveros/leveros/core"
Package core provides common utilities to be used throughout various Lever binaries and libraries. These utilities are very specific to Lever.
Package core is a generated protocol buffer package.
It is generated from these files:
leverrpc.proto
It has these top-level messages:
RPC StreamMessage RPCReply JSON JSONObject JSONArray JSONProperty
core.go leverjson.go leverrpc.go leverrpc.pb.go leverurl.go
const ( // RPCMethodHandler represents the gRPC method handling Lever RPCs. RPCMethodHandler = "HandleRPC" // StreamingRPCMethodHandler represents the gRPC method handling streaming // Lever RPCs. StreamingRPCMethodHandler = "HandleStreamingRPC" )
const PackageName = "core"
PackageName is the name of this package.
var ( // InstanceListenPortFlag is the port Lever instances listen on for // Lever RPCs. InstanceListenPortFlag = config.DeclareString( PackageName, "instanceListenPort", "3837") // InternalEnvironmentSuffixFlag represents the ending of the environment // host name to which RPCs can be routed to directly (via internal proxies). InternalEnvironmentSuffixFlag = config.DeclareString( PackageName, "internalEnvSufix", ".lever") // DefaultDevAliasFlag is the actual address of the default Lever // environment used for local development. DefaultDevAliasFlag = config.DeclareString( PackageName, "defaultDevAlias", getDefaultLeverOSIPPort()) // DefaultDevEnvFlag is the default Lever environment used for local // development. DefaultDevEnvFlag = config.DeclareString( PackageName, "defaultDevEnv", "dev.lever") // AdminEnvFlag is the admin Lever environment. AdminEnvFlag = config.DeclareString( PackageName, "adminEnv", "admin.lever") )
IsAdmin returns true iff the env + service represent the admin service.
IsInternalEnvironment returns true iff the provided environment is part of the same Lever deployment (RPCs can be routed internally).
func RegisterLeverRPCServer(s *grpc.Server, srv LeverRPCServer)
type JSON struct { // Note: If none are set then the value is null. // // Types that are valid to be assigned to JsonValueOneof: // *JSON_JsonString // *JSON_JsonNumber // *JSON_JsonBool // *JSON_JsonObject // *JSON_JsonArray JsonValueOneof isJSON_JsonValueOneof `protobuf_oneof:"json_value_oneof"` }
JSON represents a JSON-like value, which is represented as a proto message.
func (m *JSON) GetJsonObject() *JSONObject
func (*JSON) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type JSONArray struct { Element []*JSON `protobuf:"bytes,1,rep,name=element" json:"element,omitempty"` }
type JSONObject struct { Property []*JSONProperty `protobuf:"bytes,1,rep,name=property" json:"property,omitempty"` }
func (*JSONObject) Descriptor() ([]byte, []int)
func (m *JSONObject) GetProperty() []*JSONProperty
func (*JSONObject) ProtoMessage()
func (m *JSONObject) Reset()
func (m *JSONObject) String() string
type JSONProperty struct { Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` Value *JSON `protobuf:"bytes,2,opt,name=value" json:"value,omitempty"` }
func (*JSONProperty) Descriptor() ([]byte, []int)
func (m *JSONProperty) GetValue() *JSON
func (*JSONProperty) ProtoMessage()
func (m *JSONProperty) Reset()
func (m *JSONProperty) String() string
type JSON_JsonArray struct { JsonArray *JSONArray `protobuf:"bytes,5,opt,name=json_array,json=jsonArray,oneof"` }
type JSON_JsonBool struct { JsonBool bool `protobuf:"varint,3,opt,name=json_bool,json=jsonBool,oneof"` }
type JSON_JsonNumber struct { JsonNumber float64 `protobuf:"fixed64,2,opt,name=json_number,json=jsonNumber,oneof"` }
type JSON_JsonObject struct { JsonObject *JSONObject `protobuf:"bytes,4,opt,name=json_object,json=jsonObject,oneof"` }
type JSON_JsonString struct { JsonString string `protobuf:"bytes,1,opt,name=json_string,json=jsonString,oneof"` }
type LeverConfig struct { Service string `json:"name"` Description string `json:"description,omitempty"` // Only one may be specified. EntryPoint []string `json:"entry,omitempty"` JSEntryPoint string `json:"jsEntry,omitempty"` IsPrivate bool `json:"private,omitempty"` MaxInstanceLoad float64 `json:"maxInstanceLoad,omitempty"` MinInstances int `json:"minInstances,omitempty"` InstanceMemoryMB int `json:"ram,omitempty"` // TODO: Future: Allow cust to add own config which can be read from within // the service. Changing just these would not cause service restart. // Think feature flags. CustConfig map[string]interface{} `json:"config,omitempty"` }
LeverConfig is the representation of the contents of lever.json.
func ReadLeverConfig(dirPath string) (*LeverConfig, error)
ReadLeverConfig reads lever.json from the provided directory.
func (leverConfig *LeverConfig) GeneralEntryPoint() []string
GeneralEntryPoint returns the entry point specified by the config. (Whether that is specified via entry, goEntry etc).
func (leverConfig *LeverConfig) Write(dirPath string) error
Write writes lever.json to provied directory.
type LeverRPCClient interface { HandleRPC(ctx context.Context, in *RPC, opts ...grpc.CallOption) (*RPCReply, error) HandleStreamingRPC(ctx context.Context, opts ...grpc.CallOption) (LeverRPC_HandleStreamingRPCClient, error) }
func NewLeverRPCClient(cc *grpc.ClientConn) LeverRPCClient
type LeverRPCServer interface { HandleRPC(context.Context, *RPC) (*RPCReply, error) HandleStreamingRPC(LeverRPC_HandleStreamingRPCServer) error }
type LeverRPC_HandleStreamingRPCClient interface { Send(*StreamMessage) error Recv() (*StreamMessage, error) grpc.ClientStream }
func SendStreamingLeverRPC( conn *grpc.ClientConn, ctx context.Context, leverURL *LeverURL, opts ...grpc.CallOption) ( LeverRPC_HandleStreamingRPCClient, error)
SendStreamingLeverRPC sends a Lever streaming RPC to a certain resource within the service being contacted.
type LeverRPC_HandleStreamingRPCServer interface { Send(*StreamMessage) error Recv() (*StreamMessage, error) grpc.ServerStream }
LeverURL holds information about a Lever RPC destination.
ParseLeverURL parses a URL into a LeverURL. Formats accepted are
Absolute:
lever://<host>[:<port>]/<service>[/<resource>]/<method>
or
Relative (within same environment):
/<service>[/<resource>]/method
String returns the URL string representation of the LeverURL. If Environment is "" then the URL will be relative.
type RPC struct { // Types that are valid to be assigned to ArgsOneof: // *RPC_Args // *RPC_ByteArgs ArgsOneof isRPC_ArgsOneof `protobuf_oneof:"args_oneof"` }
RPC is the message used to invoke a Lever service's method.
func (*RPC) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type RPCReply struct { // Types that are valid to be assigned to ResultOneof: // *RPCReply_Result // *RPCReply_ByteResult // *RPCReply_Error // *RPCReply_ByteError ResultOneof isRPCReply_ResultOneof `protobuf_oneof:"result_oneof"` }
RPCReply is used as a return value for a Lever RPC method invokation.
func SendLeverRPC( conn *grpc.ClientConn, ctx context.Context, leverURL *LeverURL, in *RPC, opts ...grpc.CallOption) (*RPCReply, error)
SendLeverRPC sends a Lever RPC to a certain resource within the service being contacted.
func (*RPCReply) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type RPCReply_ByteError struct { ByteError []byte `protobuf:"bytes,4,opt,name=byte_error,json=byteError,proto3,oneof"` }
type RPCReply_ByteResult struct { ByteResult []byte `protobuf:"bytes,2,opt,name=byte_result,json=byteResult,proto3,oneof"` }
type RPC_ByteArgs struct { ByteArgs []byte `protobuf:"bytes,2,opt,name=byte_args,json=byteArgs,proto3,oneof"` }
type StreamMessage struct { // Note that the invokation details (rpc field) are part of the very first // message sent by the client. It is an error for any other message to have // that field set. // Also, the very first message sent by the server must be an empty // message. This is a workaround for some reverse-proxies which do funny // things if there's no data frame. // // Types that are valid to be assigned to MessageOneof: // *StreamMessage_Rpc // *StreamMessage_Message // *StreamMessage_ByteMessage // *StreamMessage_Error // *StreamMessage_ByteError MessageOneof isStreamMessage_MessageOneof `protobuf_oneof:"message_oneof"` }
StreamMessage represents individual messages sent in a streaming RPC call. These may be either sent or received.
func (*StreamMessage) Descriptor() ([]byte, []int)
func (m *StreamMessage) GetByteError() []byte
func (m *StreamMessage) GetByteMessage() []byte
func (m *StreamMessage) GetError() *JSON
func (m *StreamMessage) GetMessage() *JSON
func (m *StreamMessage) GetMessageOneof() isStreamMessage_MessageOneof
func (m *StreamMessage) GetRpc() *RPC
func (*StreamMessage) ProtoMessage()
func (m *StreamMessage) Reset()
func (m *StreamMessage) String() string
func (*StreamMessage) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type StreamMessage_ByteError struct { ByteError []byte `protobuf:"bytes,5,opt,name=byte_error,json=byteError,proto3,oneof"` }
type StreamMessage_ByteMessage struct { ByteMessage []byte `protobuf:"bytes,3,opt,name=byte_message,json=byteMessage,proto3,oneof"` }
Package core imports 12 packages (graph) and is imported by 50 packages. Updated 2016-07-23. Refresh now. Tools for package owners.