Ejemplo n.º 1
0
        public void Execute()
        {
            var client = _pool.GetClient();

            if (_descriptors.Count > 0)
            {
                var mutations = _descriptors.Select(x => new Mutation
                {
                    Column   = x.GetBytes(),
                    IsDelete = true
                }).ToList();

                var batches = _entities.Select(x => new BatchMutation
                {
                    Row       = RowkeyProcessor.ExtractFromEntity(x, _map.RowKey).GetBytes(),
                    Mutations = mutations
                }).ToList();

                batches.Split(_batchSize).ForEach(x => client.mutateRows(_tableName, x, null));
            }
            else
            {
                _entities.ForEach(x =>
                                  client.deleteAllRow(_tableName, RowkeyProcessor.ExtractFromEntity(x, _map.RowKey).GetBytes(),
                                                      null));
            }

            _pool.ReleaseClient(client);
        }
Ejemplo n.º 2
0
        public IList <HBaseCell> Serialize(ClassMap map, TEntity entity, IList <string> descriptors)
        {
            var accessor = ObjectAccessor.Create(entity);

            var key = RowkeyProcessor.ExtractFromEntity(entity, map.RowKey, accessor);

            return(ProcessMap(map, accessor, key, descriptors));
        }
        public TEntity BuildEntity(TRowResult input)
        {
            var target   = _activator.Activate();
            var accessor = ObjectAccessor.Create(target);

            var timestamps = new ConcurrentDictionary <string, long>();


            ProcessMap(_map, accessor, input.Columns, timestamps);
            RowkeyProcessor.PopulateEntity(target, _map.RowKey, input.Row, accessor);

            if (target is ITimestamp ts)
            {
                ts.Set(new Dictionary <string, long>(timestamps));
            }

            return(target);
        }