Пример #1
0
        public void BatchInsert(string key, IDictionary <string, IList <Column> > columnMap, IDictionary <string, IList <SuperColumn> > superColumnMap)
        {
            if (columnMap == null && superColumnMap == null)
            {
                throw new Exception("columnMap and SuperColumnMap can not be null at same time");
            }

            var cfmap = new Dictionary <string, List <Apache.Cassandra.ColumnOrSuperColumn> >();

            if (columnMap != null)
            {
                foreach (var map in columnMap)
                {
                    cfmap.Add(map.Key, GetSoscList(map.Value));
                }
            }

            if (superColumnMap != null)
            {
                foreach (var map in superColumnMap)
                {
                    cfmap.Add(map.Key, GetSoscSuperList(map.Value));
                }
            }

            var op = new VoidOperation(ClientCounter.WRITE_FAIL,
                                       client => client.batch_insert(Name, key, cfmap, ConsistencyLevel.ToThrift())
                                       );

            OperateWithFailover(op);
        }
Пример #2
0
        public void Remove(string key, ColumnPath columnPath)
        {
            var op = new VoidOperation(ClientCounter.WRITE_FAIL,
                                       client =>
            {
                client.remove(Name, key, columnPath.ToThrift(), Util.UnixTimestamp, ConsistencyLevel.ToThrift());
            }
                                       );

            OperateWithFailover(op);
        }
Пример #3
0
        public void Insert(string key, ColumnPath columnPath, byte[] value)
        {
            AssertColumnPath(columnPath);

            var op = new VoidOperation(ClientCounter.WRITE_FAIL,
                                       client =>
            {
                client.insert(Name, key, columnPath.ToThrift(), value, Util.UnixTimestamp, ConsistencyLevel.ToThrift());
            });

            OperateWithFailover(op);
        }
Пример #4
0
        public void BatchInsert(string key, IDictionary<string, IList<Column>> columnMap, IDictionary<string, IList<SuperColumn>> superColumnMap)
        {
            if (columnMap == null && superColumnMap == null)
                throw new Exception("columnMap and SuperColumnMap can not be null at same time");

            var cfmap = new Dictionary<string, List<Apache.Cassandra051.ColumnOrSuperColumn>>();

            if (columnMap != null)
                foreach (var map in columnMap)
                    cfmap.Add(map.Key, GetSoscList(map.Value));

            if (superColumnMap != null)
                foreach (var map in superColumnMap)
                    cfmap.Add(map.Key, GetSoscSuperList(map.Value));

            var op = new VoidOperation(ClientCounter.WRITE_FAIL,
                client => client.batch_insert(Name, key, cfmap, ConsistencyLevel.ToThrift())
            );

            OperateWithFailover(op);
        }
Пример #5
0
 public void Remove(string key, ColumnPath columnPath)
 {
     var op = new VoidOperation(ClientCounter.WRITE_FAIL,
         client =>
         {
             client.remove(Name, key, columnPath.ToThrift(), Util.UnixTimestamp, ConsistencyLevel.ToThrift());
         }
     );
     OperateWithFailover(op);
 }
Пример #6
0
        public void Insert(string key, ColumnPath columnPath, byte[] value)
        {
            AssertColumnPath(columnPath);

            var op = new VoidOperation(ClientCounter.WRITE_FAIL,
                client =>
                {
                    client.insert(Name, key, columnPath.ToThrift(), value, Util.UnixTimestamp, ConsistencyLevel.ToThrift());
                });
            OperateWithFailover(op);
        }