Remove unused classes
Summary: This is a followup diff for https://reviews.facebook.net/D15447, which picks the most simple task: delete some unused memtable reps. Test Plan: make Reviewers: haobo, dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D15585
This commit is contained in:
parent
a5e220f5ef
commit
3170abd297
@ -180,86 +180,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// HashSkipListRep is backed by hash map of buckets. Each bucket is a skip
|
// This class contains a fixed array of buckets, each
|
||||||
// list. All the keys with the same prefix will be in the same bucket.
|
|
||||||
// The prefix is determined using user supplied SliceTransform. It has
|
|
||||||
// to match prefix_extractor in options.prefix_extractor.
|
|
||||||
//
|
|
||||||
// Iteration over the entire collection is implemented by dumping all the keys
|
|
||||||
// into a separate skip list. Thus, these data structures are best used when
|
|
||||||
// iteration over the entire collection is rare.
|
|
||||||
//
|
|
||||||
// Parameters:
|
|
||||||
// transform: The SliceTransform to bucket user keys on. TransformRepFactory
|
|
||||||
// owns the pointer.
|
|
||||||
// bucket_count: Passed to the constructor of the underlying
|
|
||||||
// std::unordered_map of each TransformRep. On initialization, the
|
|
||||||
// underlying array will be at least bucket_count size.
|
|
||||||
// num_locks: Number of read-write locks to have for the rep. Each bucket is
|
|
||||||
// hashed onto a read-write lock which controls access to that lock. More
|
|
||||||
// locks means finer-grained concurrency but more memory overhead.
|
|
||||||
class TransformRepFactory : public MemTableRepFactory {
|
|
||||||
public:
|
|
||||||
explicit TransformRepFactory(const SliceTransform* transform,
|
|
||||||
size_t bucket_count, size_t num_locks = 1000)
|
|
||||||
: transform_(transform),
|
|
||||||
bucket_count_(bucket_count),
|
|
||||||
num_locks_(num_locks) { }
|
|
||||||
|
|
||||||
virtual ~TransformRepFactory() { delete transform_; }
|
|
||||||
|
|
||||||
virtual MemTableRep* CreateMemTableRep(MemTableRep::KeyComparator&,
|
|
||||||
Arena*) override;
|
|
||||||
|
|
||||||
virtual const char* Name() const override {
|
|
||||||
return "TransformRepFactory";
|
|
||||||
}
|
|
||||||
|
|
||||||
const SliceTransform* GetTransform() { return transform_; }
|
|
||||||
|
|
||||||
protected:
|
|
||||||
const SliceTransform* transform_;
|
|
||||||
const size_t bucket_count_;
|
|
||||||
const size_t num_locks_;
|
|
||||||
};
|
|
||||||
|
|
||||||
// UnsortedReps bin user keys based on an identity function transform -- that
|
|
||||||
// is, transform(key) = key. This optimizes for point look-ups.
|
|
||||||
//
|
|
||||||
// Parameters: See TransformRepFactory.
|
|
||||||
class UnsortedRepFactory : public TransformRepFactory {
|
|
||||||
public:
|
|
||||||
explicit UnsortedRepFactory(size_t bucket_count = 0, size_t num_locks = 1000)
|
|
||||||
: TransformRepFactory(NewNoopTransform(),
|
|
||||||
bucket_count,
|
|
||||||
num_locks) { }
|
|
||||||
virtual const char* Name() const override {
|
|
||||||
return "UnsortedRepFactory";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// PrefixHashReps bin user keys based on a fixed-size prefix. This optimizes for
|
|
||||||
// short ranged scans over a given prefix.
|
|
||||||
//
|
|
||||||
// Parameters: See TransformRepFactory.
|
|
||||||
class PrefixHashRepFactory : public TransformRepFactory {
|
|
||||||
public:
|
|
||||||
explicit PrefixHashRepFactory(const SliceTransform* prefix_extractor,
|
|
||||||
size_t bucket_count = 0, size_t num_locks = 1000)
|
|
||||||
: TransformRepFactory(prefix_extractor, bucket_count, num_locks)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual MemTableRep* CreateMemTableRep(MemTableRep::KeyComparator&,
|
|
||||||
Arena*) override;
|
|
||||||
|
|
||||||
virtual const char* Name() const override {
|
|
||||||
return "PrefixHashRepFactory";
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// The same as TransformRepFactory except it doesn't use locks.
|
|
||||||
// Experimental, will replace TransformRepFactory once we are sure
|
|
||||||
// it performs better. It contains a fixed array of buckets, each
|
|
||||||
// pointing to a skiplist (null if the bucket is empty).
|
// pointing to a skiplist (null if the bucket is empty).
|
||||||
// bucket_count: number of fixed array buckets
|
// bucket_count: number of fixed array buckets
|
||||||
// skiplist_height: the max height of the skiplist
|
// skiplist_height: the max height of the skiplist
|
||||||
|
Loading…
Reference in New Issue
Block a user