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

Side by Side Diff: appengine/logdog/coordinator/hierarchy/hierarchy.go

Issue 1967273002: LogDog: Implement RegisterPrefix RPC. (Closed) Base URL: https://github.com/luci/luci-go@logdog-butler-register-coordinator-endpoint
Patch Set: Updated patchset dependency Created 4 years, 7 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package hierarchy 5 package hierarchy
6 6
7 import ( 7 import (
8 "crypto/sha256" 8 "crypto/sha256"
9 "encoding/base64" 9 "encoding/base64"
10 "encoding/hex" 10 "encoding/hex"
(...skipping 22 matching lines...) Expand all
33 // 33 //
34 // Storing the component's name in its key ensures that a keys query will pull 34 // Storing the component's name in its key ensures that a keys query will pull
35 // the set of elements in the correct order, requiring no non-default indexes. 35 // the set of elements in the correct order, requiring no non-default indexes.
36 // 36 //
37 // Writing path components is inherently idempotent, since each one is defined 37 // Writing path components is inherently idempotent, since each one is defined
38 // solely by its identity. Consequently, transactions are not necessary when 38 // solely by its identity. Consequently, transactions are not necessary when
39 // writing path components. 39 // writing path components.
40 // 40 //
41 // All componentEntity share a common implicit ancestor, "/". 41 // All componentEntity share a common implicit ancestor, "/".
42 // 42 //
43 // This entity is created at stream registration, and is entirely centered 43 // This entity is created at stream and prefix registration, and is entirely
44 // around being queried for log stream "directory" listings. For example: 44 // centered around being queried for log stream "directory" listings. For
45 // example:
45 // 46 //
46 // foo/bar/+/baz/qux 47 // foo/bar/+/baz/qux
47 // 48 //
48 // This stream would add the following name components to the datastore, keyed 49 // This stream would add the following name components to the datastore, keyed
49 // (parent-key, id) as: 50 // (parent-key, id) as:
50 // ("/", "foo") 51 // ("/", "foo")
51 // ("/foo", "bar") 52 // ("/foo", "bar")
52 // ("/foo/bar", "+") 53 // ("/foo/bar", "+")
53 // ("/foo/bar/+", "baz") 54 // ("/foo/bar/+", "baz")
54 // ("/foo/bar/+/baz", "qux") 55 // ("/foo/bar/+/baz", "qux")
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 267
267 return di.NewKey("_StreamNameComponent", string(d), 0, nil), nil 268 return di.NewKey("_StreamNameComponent", string(d), 0, nil), nil
268 } 269 }
269 270
270 // cursorForKey returns a cursor for the supplied componentID. This cursor will 271 // cursorForKey returns a cursor for the supplied componentID. This cursor will
271 // start new queries at the component immediately following this ID. 272 // start new queries at the component immediately following this ID.
272 func cursorForKey(di ds.Interface, e *componentEntity) string { 273 func cursorForKey(di ds.Interface, e *componentEntity) string {
273 key := di.KeyForObj(e) 274 key := di.KeyForObj(e)
274 return base64.URLEncoding.EncodeToString([]byte(key.StringID())) 275 return base64.URLEncoding.EncodeToString([]byte(key.StringID()))
275 } 276 }
OLDNEW
« no previous file with comments | « appengine/logdog/coordinator/endpoints/services/registerStream_test.go ('k') | appengine/logdog/coordinator/logPrefix.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698