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

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

Issue 2435113002: LogDog: Add Storage-layer data caching. (Closed)
Patch Set: Fix byteLimit bug. Created 4 years, 1 month 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/cache.go ('k') | no next file » | 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 memory 5 package memory
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "sync" 9 "sync"
10 "time" 10 "time"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 var _ storage.Storage = (*Storage)(nil) 50 var _ storage.Storage = (*Storage)(nil)
51 51
52 // Close implements storage.Storage. 52 // Close implements storage.Storage.
53 func (s *Storage) Close() { 53 func (s *Storage) Close() {
54 s.run(func() error { 54 s.run(func() error {
55 s.closed = true 55 s.closed = true
56 return nil 56 return nil
57 }) 57 })
58 } 58 }
59 59
60 // ResetClose resets the storage instance, allowing it to be used another time.
61 // The data stored in this instance is not changed.
62 func (s *Storage) ResetClose() {
63 s.stateMu.Lock()
64 defer s.stateMu.Unlock()
65
66 s.closed = false
67 }
68
60 // Config implements storage.Storage. 69 // Config implements storage.Storage.
61 func (s *Storage) Config(cfg storage.Config) error { 70 func (s *Storage) Config(cfg storage.Config) error {
62 return s.run(func() error { 71 return s.run(func() error {
63 s.MaxLogAge = cfg.MaxLogAge 72 s.MaxLogAge = cfg.MaxLogAge
64 return nil 73 return nil
65 }) 74 })
66 } 75 }
67 76
68 // Put implements storage.Storage. 77 // Put implements storage.Storage.
69 func (s *Storage) Put(req storage.PutRequest) error { 78 func (s *Storage) Put(req storage.PutRequest) error {
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 } 218 }
210 219
211 if s.streams == nil { 220 if s.streams == nil {
212 s.streams = map[streamKey]*logStream{} 221 s.streams = map[streamKey]*logStream{}
213 } 222 }
214 s.streams[key] = ls 223 s.streams[key] = ls
215 } 224 }
216 225
217 return ls 226 return ls
218 } 227 }
OLDNEW
« no previous file with comments | « logdog/common/storage/memory/cache.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698