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

Side by Side Diff: logdog/common/storage/storage.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « logdog/common/storage/memory/memory_test.go ('k') | logdog/common/viewer/url.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The LUCI Authors. All rights reserved. 1 // Copyright 2015 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0 2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file. 3 // that can be found in the LICENSE file.
4 4
5 package storage 5 package storage
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "time" 9 "time"
10 10
11 "github.com/luci/luci-go/common/config"
12 "github.com/luci/luci-go/logdog/common/types" 11 "github.com/luci/luci-go/logdog/common/types"
12 "github.com/luci/luci-go/luci_config/common/cfgtypes"
13 ) 13 )
14 14
15 var ( 15 var (
16 // ErrExists returned if an attempt is made to overwrite an existing rec ord. 16 // ErrExists returned if an attempt is made to overwrite an existing rec ord.
17 ErrExists = errors.New("storage: record exists") 17 ErrExists = errors.New("storage: record exists")
18 18
19 // ErrDoesNotExist returned if an attempt is made to read a record that 19 // ErrDoesNotExist returned if an attempt is made to read a record that
20 // doesn't exist. 20 // doesn't exist.
21 ErrDoesNotExist = errors.New("storage: record does not exist") 21 ErrDoesNotExist = errors.New("storage: record does not exist")
22 22
(...skipping 10 matching lines...) Expand all
33 type Config struct { 33 type Config struct {
34 // MaxLogAge is the maximium amount of time that a log entry must be kep t for. 34 // MaxLogAge is the maximium amount of time that a log entry must be kep t for.
35 // The Storage instance is welcome to delete any log entries that exceed this 35 // The Storage instance is welcome to delete any log entries that exceed this
36 // age. 36 // age.
37 MaxLogAge time.Duration 37 MaxLogAge time.Duration
38 } 38 }
39 39
40 // PutRequest describes adding a single storage record to BigTable. 40 // PutRequest describes adding a single storage record to BigTable.
41 type PutRequest struct { 41 type PutRequest struct {
42 // Project is the project name of the stream. 42 // Project is the project name of the stream.
43 » Project config.ProjectName 43 » Project cfgtypes.ProjectName
44 // Path is the stream path to retrieve. 44 // Path is the stream path to retrieve.
45 Path types.StreamPath 45 Path types.StreamPath
46 // Index is the entry's stream index. 46 // Index is the entry's stream index.
47 Index types.MessageIndex 47 Index types.MessageIndex
48 48
49 // Values are contiguous sequential records to add to the storage. The f irst 49 // Values are contiguous sequential records to add to the storage. The f irst
50 // index in values corresponds to Index. 50 // index in values corresponds to Index.
51 Values [][]byte 51 Values [][]byte
52 } 52 }
53 53
54 // GetRequest is a request to retrieve a series of LogEntry records. 54 // GetRequest is a request to retrieve a series of LogEntry records.
55 type GetRequest struct { 55 type GetRequest struct {
56 // Project is the project name of the stream. 56 // Project is the project name of the stream.
57 » Project config.ProjectName 57 » Project cfgtypes.ProjectName
58 // Path is the stream path to retrieve. 58 // Path is the stream path to retrieve.
59 Path types.StreamPath 59 Path types.StreamPath
60 // Index is the entry's stream index. 60 // Index is the entry's stream index.
61 Index types.MessageIndex 61 Index types.MessageIndex
62 62
63 // Limit is the maximum number of records to return before stopping iter ation. 63 // Limit is the maximum number of records to return before stopping iter ation.
64 // If <= 0, no maximum limit will be applied. 64 // If <= 0, no maximum limit will be applied.
65 // 65 //
66 // The Storage instance may return fewer records than the supplied Limit as an 66 // The Storage instance may return fewer records than the supplied Limit as an
67 // implementation detail. 67 // implementation detail.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // the requested stream does not exist, and an error if an error occurre d 110 // the requested stream does not exist, and an error if an error occurre d
111 // during retrieval. 111 // during retrieval.
112 Get(GetRequest, GetCallback) error 112 Get(GetRequest, GetCallback) error
113 113
114 // Tail retrieves the latest log in the stream. If the stream has no log s, it 114 // Tail retrieves the latest log in the stream. If the stream has no log s, it
115 // will fail with ErrDoesNotExist. 115 // will fail with ErrDoesNotExist.
116 // 116 //
117 // The MessageIndex may be -1 if the message index isn't known. In this case, 117 // The MessageIndex may be -1 if the message index isn't known. In this case,
118 // the caller will have to unmarshal the log entry data to determine its 118 // the caller will have to unmarshal the log entry data to determine its
119 // index. 119 // index.
120 » Tail(config.ProjectName, types.StreamPath) (*Entry, error) 120 » Tail(cfgtypes.ProjectName, types.StreamPath) (*Entry, error)
121 121
122 // Config installs the supplied configuration parameters into the storag e 122 // Config installs the supplied configuration parameters into the storag e
123 // instance. 123 // instance.
124 Config(Config) error 124 Config(Config) error
125 } 125 }
OLDNEW
« no previous file with comments | « logdog/common/storage/memory/memory_test.go ('k') | logdog/common/viewer/url.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698