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

Unified Diff: logdog/client/coordinator/list.go

Issue 2991253004: [logdog] Remove list functionality. (Closed)
Patch Set: fix test Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « logdog/client/coordinator/client_test.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: logdog/client/coordinator/list.go
diff --git a/logdog/client/coordinator/list.go b/logdog/client/coordinator/list.go
deleted file mode 100644
index bc60fc8407c666b7329ca4f0c7c02d2f7855cc2a..0000000000000000000000000000000000000000
--- a/logdog/client/coordinator/list.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2016 The LUCI Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package coordinator
-
-import (
- "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1"
- "github.com/luci/luci-go/logdog/common/types"
- "github.com/luci/luci-go/luci_config/common/cfgtypes"
- "golang.org/x/net/context"
-)
-
-// ListResult is a single returned list entry.
-type ListResult struct {
- // Project is the project that this result is bound to.
- Project cfgtypes.ProjectName
- // PathBase is the base part of the list path. This will match the base that
- // the list was pulled from.
- PathBase types.StreamPath
- // Name is the name of this component, relative to PathBase.
- Name string
- // Stream is true if this list component is a stream component. Otherwise,
- // it's an intermediate path component.
- Stream bool
-
- // State is the state of the log stream. This will be populated if this is a
- // stream component and state was requested.
- State *LogStream
-}
-
-// FullPath returns the full StreamPath of this result. If it is not a stream,
-// it will return an empty path.
-func (lr *ListResult) FullPath() types.StreamPath {
- return types.StreamPath(lr.PathBase).Append(lr.Name)
-}
-
-// ListCallback is a callback method type that is used in list requests.
-//
-// If it returns false, additional callbacks and list requests will be aborted.
-type ListCallback func(*ListResult) bool
-
-// ListOptions is a set of list request options.
-type ListOptions struct {
- // StreamsOnly requests that only stream components are returned. Intermediate
- // path components will be omitted.
- StreamsOnly bool
- // State, if true, requests that the full log stream descriptor and state get
- // included in returned stream list components.
- State bool
-
- // Purged, if true, requests that purged log streams are included in the list
- // results. This will result in an error if the user is not privileged to see
- // purged logs.
- Purged bool
-}
-
-// List executes a log stream hierarchy listing for the specified path.
-//
-// If project is the empty string, a top-level project listing will be returned.
-func (c *Client) List(ctx context.Context, project cfgtypes.ProjectName, pathBase string, o ListOptions, cb ListCallback) error {
- req := logdog.ListRequest{
- Project: string(project),
- PathBase: pathBase,
- StreamOnly: o.StreamsOnly,
- State: o.State,
- IncludePurged: o.Purged,
- }
-
- for {
- resp, err := c.C.List(ctx, &req)
- if err != nil {
- return normalizeError(err)
- }
-
- for _, s := range resp.Components {
- lr := ListResult{
- Project: cfgtypes.ProjectName(resp.Project),
- PathBase: types.StreamPath(resp.PathBase),
- Name: s.Name,
- }
- switch s.Type {
- case logdog.ListResponse_Component_PATH:
- break
-
- case logdog.ListResponse_Component_STREAM:
- lr.Stream = true
- if s.State != nil {
- lr.State = loadLogStream(resp.Project, lr.FullPath(), s.State, s.Desc)
- }
-
- case logdog.ListResponse_Component_PROJECT:
- lr.Project = cfgtypes.ProjectName(lr.Name)
- }
-
- if !cb(&lr) {
- return nil
- }
- }
-
- if resp.Next == "" {
- return nil
- }
- req.Next = resp.Next
- }
-}
« no previous file with comments | « logdog/client/coordinator/client_test.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698