-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from raulk/txndatastore
Migrate to ds.TxnDatastore, optimisations++, cache changes, benchmarks
- Loading branch information
Showing
10 changed files
with
761 additions
and
264 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package pstoreds | ||
|
||
// cache abstracts all methods we access from ARCCache, to enable alternate | ||
// implementations such as a no-op one. | ||
type cache interface { | ||
Get(key interface{}) (value interface{}, ok bool) | ||
Add(key, value interface{}) | ||
Remove(key interface{}) | ||
Contains(key interface{}) bool | ||
Peek(key interface{}) (value interface{}, ok bool) | ||
} | ||
|
||
// noopCache is a dummy implementation that's used when the cache is disabled. | ||
type noopCache struct { | ||
} | ||
|
||
func (*noopCache) Get(key interface{}) (value interface{}, ok bool) { | ||
return nil, false | ||
} | ||
|
||
func (*noopCache) Add(key, value interface{}) { | ||
} | ||
|
||
func (*noopCache) Remove(key interface{}) { | ||
} | ||
|
||
func (*noopCache) Contains(key interface{}) bool { | ||
return false | ||
} | ||
|
||
func (*noopCache) Peek(key interface{}) (value interface{}, ok bool) { | ||
return nil, false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.