Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(174)

Unified Diff: logdog/common/storage/storage.go

Issue 2435883002: LogDog: Fix archival Get/Tail implementations. (Closed)
Patch Set: LogDog: Fix archival Get/Tail implementations. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: logdog/common/storage/storage.go
diff --git a/logdog/common/storage/storage.go b/logdog/common/storage/storage.go
index 39ae288a6188918fecf904c945cae63cf2b9201c..ba09397d1a6504cc4305133cd75e0fa59ab38fea 100644
--- a/logdog/common/storage/storage.go
+++ b/logdog/common/storage/storage.go
@@ -61,7 +61,7 @@ type GetRequest struct {
Index types.MessageIndex
// Limit is the maximum number of records to return before stopping iteration.
- // If zero, no maximum limit will be applied.
+ // If <= 0, no maximum limit will be applied.
//
// The Storage instance may return fewer records than the supplied Limit as an
// implementation detail.
@@ -74,7 +74,10 @@ type GetRequest struct {
// GetCallback is invoked for each record in the Get request. If it returns
// false, iteration should stop.
-type GetCallback func(types.MessageIndex, []byte) bool
+//
+// The MessageIndex may be -1 if the message index isn't known. In this case,
+// the caller will have to unmarshal the log entry data to determine its index.
+type GetCallback func(*Entry) bool
// Storage is an abstract LogDog storage implementation. Interfaces implementing
// this may be used to store and retrieve log records by the collection service
@@ -109,8 +112,12 @@ type Storage interface {
Get(GetRequest, GetCallback) error
// Tail retrieves the latest log in the stream. If the stream has no logs, it
- // will return ErrDoesNotExist.
- Tail(config.ProjectName, types.StreamPath) ([]byte, types.MessageIndex, error)
+ // will fail with ErrDoesNotExist.
+ //
+ // The MessageIndex may be -1 if the message index isn't known. In this case,
+ // the caller will have to unmarshal the log entry data to determine its
+ // index.
+ Tail(config.ProjectName, types.StreamPath) (*Entry, error)
// Config installs the supplied configuration parameters into the storage
// instance.

Powered by Google App Engine
This is Rietveld 408576698