OLD | NEW |
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 "bytes" | 8 "bytes" |
9 "fmt" | 9 "fmt" |
10 "strings" | 10 "strings" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 109 } |
110 return ret | 110 return ret |
111 } | 111 } |
112 | 112 |
113 var ( | 113 var ( |
114 prop = ds.MkProperty | 114 prop = ds.MkProperty |
115 propNI = ds.MkPropertyNI | 115 propNI = ds.MkPropertyNI |
116 ) | 116 ) |
117 | 117 |
118 func key(elems ...interface{}) *ds.Key { | 118 func key(elems ...interface{}) *ds.Key { |
119 » return ds.MakeKey("dev~app", "ns", elems...) | 119 » return ds.KeyContext{"dev~app", "ns"}.MakeKey(elems...) |
120 } | 120 } |
121 | 121 |
122 func die(err error) { | 122 func die(err error) { |
123 if err != nil { | 123 if err != nil { |
124 panic(err) | 124 panic(err) |
125 } | 125 } |
126 } | 126 } |
127 | 127 |
128 // cat is a convenience method for concatenating anything with an underlying | 128 // cat is a convenience method for concatenating anything with an underlying |
129 // byte representation into a single []byte. | 129 // byte representation into a single []byte. |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 ret := cat(bytethings...) | 174 ret := cat(bytethings...) |
175 for i := range ret { | 175 for i := range ret { |
176 ret[i] ^= 0xFF | 176 ret[i] ^= 0xFF |
177 } | 177 } |
178 return ret | 178 return ret |
179 } | 179 } |
180 | 180 |
181 func sat(bytethings ...interface{}) string { | 181 func sat(bytethings ...interface{}) string { |
182 return string(cat(bytethings...)) | 182 return string(cat(bytethings...)) |
183 } | 183 } |
OLD | NEW |