Пример #1
0
        public PartitionTracker(Policy policy, Node[] nodes, PartitionFilter filter)
        {
            // Validate here instead of initial PartitionFilter constructor because total number of
            // cluster partitions may change on the server and PartitionFilter will never have access
            // to Cluster instance.  Use fixed number of partitions for now.
            if (!(filter.begin >= 0 && filter.begin < Node.PARTITIONS))
            {
                throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Invalid partition begin " + filter.begin +
                                             ". Valid range: 0-" + (Node.PARTITIONS - 1));
            }

            if (filter.count <= 0)
            {
                throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Invalid partition count " + filter.count);
            }

            if (filter.begin + filter.count > Node.PARTITIONS)
            {
                throw new AerospikeException(ResultCode.PARAMETER_ERROR, "Invalid partition range (" + filter.begin +
                                             ',' + filter.count + ')');
            }

            this.partitionBegin     = filter.begin;
            this.nodeCapacity       = nodes.Length;
            this.nodeFilter         = null;
            this.partitionsCapacity = filter.count;
            this.partitionsAll      = Init(policy, filter.count, filter.digest);
        }
Пример #2
0
 public PartitionTracker(QueryPolicy policy, Node[] nodes, PartitionFilter filter)
     : this((Policy)policy, nodes, filter)
 {
     this.maxRecords = policy.maxRecords;
 }