can now delete a collection! Is this a dangerous feature? Only enabling

deleting "benchmark" collections for now.
This commit is contained in:
Chris Lu
2014-03-10 11:43:54 -07:00
parent a121453188
commit cd10c277b2
13 changed files with 130 additions and 8 deletions

View File

@@ -14,6 +14,7 @@ type NeedleMapper interface {
Get(key uint64) (element *NeedleValue, ok bool)
Delete(key uint64) error
Close()
Destroy() error
ContentSize() uint64
DeletedSize() uint64
FileCount() int
@@ -155,6 +156,10 @@ func (nm *NeedleMap) Delete(key uint64) error {
func (nm *NeedleMap) Close() {
_ = nm.indexFile.Close()
}
func (nm *NeedleMap) Destroy() error {
nm.Close()
return os.Remove(nm.indexFile.Name())
}
func (nm NeedleMap) ContentSize() uint64 {
return nm.FileByteCounter
}