From a77ac582a36539df695eb7b5b09f1c193a472966 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Sat, 16 Jun 2018 17:45:48 -0700 Subject: [PATCH] note on iterators --- types/store.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/types/store.go b/types/store.go index 7885d7ab6..d0a8df07a 100644 --- a/types/store.go +++ b/types/store.go @@ -105,11 +105,15 @@ type KVStore interface { // Iterator over a domain of keys in ascending order. End is exclusive. // Start must be less than end, or the Iterator is invalid. - // To iterate over entire domain -> store.Iterator(nil, nil) + // Iterator must be closed by caller. + // To iterate over entire domain, use store.Iterator(nil, nil) + // CONTRACT: No writes may happen within a domain while an iterator exists over it. Iterator(start, end []byte) Iterator // Iterator over a domain of keys in descending order. End is exclusive. // Start must be greater than end, or the Iterator is invalid. + // Iterator must be closed by caller. + // CONTRACT: No writes may happen within a domain while an iterator exists over it. ReverseIterator(start, end []byte) Iterator // TODO Not yet implemented.