protected override void WriteFrame(IFrameWriter fw) { Stream stream = fw.WriteOnlyStream; stream.WriteLongString(CQL); fw.SetMessageType(MessageOpcodes.Prepare); }
protected override void WriteFrame(IFrameWriter fw) { Stream stream = fw.WriteOnlyStream; stream.WriteLongString(CQL); stream.WriteUShort((ushort)ConsistencyLevel); fw.SetMessageType(MessageOpcodes.Query); }
protected override void WriteFrame(IFrameWriter fw) { Dictionary <string, string> options = new Dictionary <string, string> { { "CQL_VERSION", _cqlVersion } }; fw.WriteOnlyStream.WriteStringMap(options); fw.SetMessageType(MessageOpcodes.Startup); }
protected override void WriteFrame(IFrameWriter fw) { var cql = "USE " + _keyspace; Stream stream = fw.WriteOnlyStream; stream.WriteLongString(cql); stream.WriteUShort((ushort)ConsistencyLevel); stream.WriteByte(0); fw.SetMessageType(MessageOpcodes.Query); }
protected override void WriteFrame(IFrameWriter fw) { Stream stream = fw.WriteOnlyStream; Dictionary <string, string> authParams = new Dictionary <string, string> { { "username", _user }, { "password", _password } }; stream.WriteStringMap(authParams); fw.SetMessageType(MessageOpcodes.Credentials); }
protected override void WriteFrame(IFrameWriter fw) { Stream stream = fw.WriteOnlyStream; stream.WriteShortByteArray(_id); stream.WriteUShort((ushort)_columnSpecs.Length); foreach (var columnData in _mapperIn.MapToColumns(_dataSource, _columnSpecs)) { stream.WriteByteArray(columnData.RawData); } stream.WriteUShort((ushort)ConsistencyLevel); fw.SetMessageType(MessageOpcodes.Batch); }
protected override void WriteFrame(IFrameWriter fw) { StringBuilder sb = new StringBuilder("CREATE KEYSPACE "); sb.Append(_name); sb.Append(" WITH replication = {"); sb.Append(string.Join(",", _replicationOptions.Select(x => string.Format("'{0}': '{1}'", x.Key, x.Value)))); sb.Append("} AND durable_writes = "); sb.Append(_durableWrites); Stream stream = fw.WriteOnlyStream; stream.WriteLongString(sb.ToString()); stream.WriteUShort((ushort)ConsistencyLevel); fw.SetMessageType(MessageOpcodes.Query); }
private void WriteExecuteRequest(IFrameWriter frameWriter, ConsistencyLevel cl, IDataMapperFactory factory) { frameWriter.WriteShortByteArray(_id); frameWriter.WriteShort((short) _columnSpecs.Length); IDataSource dataSource = factory.DataSource; foreach (IColumnSpec columnSpec in _columnSpecs) { object data = dataSource.Get(columnSpec); byte[] rawData = columnSpec.Serialize(data); frameWriter.WriteByteArray(rawData); } frameWriter.WriteShort((short) cl); frameWriter.SetMessageType(MessageOpcodes.Execute); }
private static void WriteReady(IFrameWriter frameWriter, string cqlVersion) { Dictionary<string, string> options = new Dictionary<string, string> { {"CQL_VERSION", cqlVersion} }; frameWriter.WriteOnlyStream.WriteStringMap(options); frameWriter.SetMessageType(MessageOpcodes.Startup); }
private static void WriteExecuteRequest(IFrameWriter frameWriter, byte[] id, IColumnSpec[] columnSpecs, ConsistencyLevel cl, IDataMapperFactory factory) { Stream stream = frameWriter.WriteOnlyStream; stream.WriteShortByteArray(id); stream.WriteShort((short) columnSpecs.Length); IDataSource dataSource = factory.DataSource; foreach (IColumnSpec columnSpec in columnSpecs) { object data = dataSource.Get(columnSpec); byte[] rawData = columnSpec.Serialize(data); stream.WriteByteArray(rawData); } stream.WriteShort((short) cl); frameWriter.SetMessageType(MessageOpcodes.Execute); }
private static void WriteQueryRequest(IFrameWriter frameWriter, string cql, ConsistencyLevel cl, MessageOpcodes opcode) { Stream stream = frameWriter.WriteOnlyStream; stream.WriteLongString(cql); stream.WriteShort((short) cl); frameWriter.SetMessageType(opcode); }
private static void WritePrepareRequest(IFrameWriter frameWriter, string cql) { Stream stream = frameWriter.WriteOnlyStream; stream.WriteLongString(cql); frameWriter.SetMessageType(MessageOpcodes.Prepare); }
private static void WriteAuthenticate(IFrameWriter frameWriter, string user, string password) { Stream stream = frameWriter.WriteOnlyStream; Dictionary<string, string> authParams = new Dictionary<string, string> { {"username", user}, {"password", password} }; stream.WriteStringMap(authParams); frameWriter.SetMessageType(MessageOpcodes.Credentials); }
private static void WriteOptions(IFrameWriter frameWriter) { frameWriter.SetMessageType(MessageOpcodes.Options); }
protected override void WriteFrame(IFrameWriter fw) { fw.SetMessageType(MessageOpcodes.Options); }