Chromium Code Reviews| Index: common/logdog/types/streamname.go |
| diff --git a/common/logdog/types/streamname.go b/common/logdog/types/streamname.go |
| index af95358ed3741685e323cff20af25f68b508ba76..f2362ac6df43d3109a8d3fdb6071cba868d5e06f 100644 |
| --- a/common/logdog/types/streamname.go |
| +++ b/common/logdog/types/streamname.go |
| @@ -164,6 +164,18 @@ func (s StreamName) Concat(o ...StreamName) StreamName { |
| return StreamName(Construct(parts...)) |
| } |
| +// AsPathPrefix uses s as the prefix component of a StreamPath and constructs |
| +// the remainder of hte path with the supplied name. |
|
nodir
2016/05/17 02:45:59
s/hte/the
dnj (Google)
2016/05/17 14:44:33
Done.
|
| +// |
| +// If name is empty, the resulting path will end in the path separator. For |
| +// example, if s is "foo/bar" and name is "", the path will be "foo/bar/+". |
| +// |
| +// If name is a valid StreamName, this will construct a valid StreamPath. If s |
|
nodir
2016/05/17 02:45:59
"If name is a valid StreamName, this will construc
dnj (Google)
2016/05/17 14:44:33
Done.
|
| +// is a valid StreamName, this will construct a valid partial StreamPath. |
| +func (s StreamName) AsPathPrefix(name StreamName) StreamPath { |
| + return StreamPath(Construct(string(s), StreamPathSepStr, string(name))) |
| +} |
| + |
| // Validate tests whether the stream name is valid. |
| func (s StreamName) Validate() error { |
| if len(s) == 0 { |
| @@ -238,21 +250,6 @@ func (s StreamName) MarshalJSON() ([]byte, error) { |
| // separator. |
| type StreamPath string |
| -// MakeStreamPath creates a StreamPath by joining prefix and name components. |
| -func MakeStreamPath(prefix, name []StreamName) StreamPath { |
| - o := len(prefix) |
| - sp := make([]string, o+len(name)+1) |
| - for i, v := range prefix { |
| - sp[i] = string(v) |
| - } |
| - sp[o] = StreamPathSepStr |
| - for _, v := range name { |
| - o++ |
| - sp[o] = string(v) |
| - } |
| - return StreamPath(Construct(sp...)) |
| -} |
| - |
| // Split splits a StreamPath into its prefix and name components. |
| // |
| // If there is no divider present (e.g., foo/bar/baz), the result will parse |