Commit f248d49b authored by Raúl Kripalani's avatar Raúl Kripalani

add support for querying entry expiration.

parent bd0caea1
......@@ -138,6 +138,7 @@ type TTLDatastore interface {
PutWithTTL(key Key, value []byte, ttl time.Duration) error
SetTTL(key Key, ttl time.Duration) error
GetExpiration(key Key) (time.Time, error)
}
// Txn extends the Datastore type. Txns allow users to batch queries and
......
package query
import (
"time"
goprocess "github.com/jbenet/goprocess"
)
......@@ -62,12 +64,14 @@ type Query struct {
Limit int // maximum number of results
Offset int // skip given number of results
KeysOnly bool // return only keys.
ReturnExpirations bool // return expirations (see TTLDatastore)
}
// Entry is a query result entry.
type Entry struct {
Key string // cant be ds.Key because circular imports ...!!!
Value []byte // Will be nil if KeysOnly has been passed.
Expiration time.Time // Entry expiration timestamp if requested and supported (see TTLDatastore).
}
// Result is a special entry that includes an error, so that the client
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment