Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/google.golang.org/grpc/internal/binarylog/sink.go')
-rw-r--r--vendor/google.golang.org/grpc/internal/binarylog/sink.go64
1 files changed, 0 insertions, 64 deletions
diff --git a/vendor/google.golang.org/grpc/internal/binarylog/sink.go b/vendor/google.golang.org/grpc/internal/binarylog/sink.go
deleted file mode 100644
index 05c694a58..000000000
--- a/vendor/google.golang.org/grpc/internal/binarylog/sink.go
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright 2018 gRPC 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 binarylog
-
-import (
- "io"
-
- "github.com/golang/protobuf/proto"
- pb "google.golang.org/grpc/binarylog/grpc_binarylog_v1"
- "google.golang.org/grpc/grpclog"
-)
-
-var (
- defaultSink Sink = &noopSink{} // TODO(blog): change this default (file in /tmp).
-)
-
-// SetDefaultSink sets the sink where binary logs will be written to.
-//
-// Not thread safe. Only set during initialization.
-func SetDefaultSink(s Sink) {
- defaultSink = s
-}
-
-// Sink writes log entry into the binary log sink.
-type Sink interface {
- Write(*pb.GrpcLogEntry)
-}
-
-type noopSink struct{}
-
-func (ns *noopSink) Write(*pb.GrpcLogEntry) {}
-
-// NewWriterSink creates a binary log sink with the given writer.
-func NewWriterSink(w io.Writer) Sink {
- return &writerSink{out: w}
-}
-
-type writerSink struct {
- out io.Writer
-}
-
-func (fs *writerSink) Write(e *pb.GrpcLogEntry) {
- b, err := proto.Marshal(e)
- if err != nil {
- grpclog.Infof("binary logging: failed to marshal proto message: %v", err)
- }
- fs.out.Write(b)
-}