Beispiel #1
0
 public IEnumerable<ServiceState> Query(string query)
 {
     var q = new Query {String = query};
     var msg = new Msg {Query = q};
     Serializer.Serialize(Tcp, msg);
     var response = Serializer.Deserialize<Msg>(Tcp);
     if (response.Ok) {
         return response.States;
     }
     throw new Exception(response.Error);
 }
Beispiel #2
0
 public IEnumerable<Proto.State> Query(string query)
 {
     var q = new Proto.Query {@string = query};
     var msg = new Proto.Msg {query = q};
     Serializer.Serialize(Stream, msg);
     var response = Serializer.Deserialize<Proto.Msg>(Stream);
     if (response.ok) {
         return response.states;
     }
     throw new Exception(response.error);
 }
Beispiel #3
0
        ///
        /// <summary>Queries Riemann</summary>
        /// <param name='query'>Query to send Riemann for process</param>
        /// <returns>List of States that answer the query.</returns>
        ///
        public IEnumerable <Proto.State> Query(string query)
        {
            var q = new Proto.Query {
                @string = query
            };
            var msg = new Proto.Msg {
                query = q
            };

            Serializer.SerializeWithLengthPrefix(_tcpStream, msg, PrefixStyle.Fixed32BigEndian);
            var response = Serializer.DeserializeWithLengthPrefix <Msg>(_tcpStream, PrefixStyle.Fixed32BigEndian);

            if (response.ok)
            {
                return(response.states);
            }
            throw new Exception(response.error);
        }