github.com/cockroachdb/cockroach@v20.2.0-alpha.1+incompatible/pkg/kv/kvserver/closedts/ctpb/server.go (about)

     1  // Copyright 2018 The Cockroach Authors.
     2  //
     3  // Use of this software is governed by the Business Source License
     4  // included in the file licenses/BSL.txt.
     5  //
     6  // As of the Change Date specified in that file, in accordance with
     7  // the Business Source License, use of this software will be governed
     8  // by the Apache License, Version 2.0, included in the file
     9  // licenses/APL.txt.
    10  
    11  package ctpb
    12  
    13  import "context"
    14  
    15  // InboundClient is an interface that narrows ClosedTimestamp_GetServer down to what's
    16  // actually required.
    17  type InboundClient interface {
    18  	Send(*Entry) error
    19  	Recv() (*Reaction, error)
    20  	Context() context.Context
    21  }
    22  
    23  // Server is the interface implemented by types that want to serve incoming
    24  // closed timestamp update streams.
    25  type Server interface {
    26  	Get(InboundClient) error
    27  }
    28  
    29  // ServerShim is a wrapper around Server that provides the wider interface that
    30  // gRPC expects.
    31  type ServerShim struct{ Server }
    32  
    33  var _ ClosedTimestampServer = (*ServerShim)(nil)
    34  
    35  // Get implements ClosedTimestampServer by passing through to the wrapped Server.
    36  func (s ServerShim) Get(client ClosedTimestamp_GetServer) error {
    37  	return s.Server.Get(client)
    38  }
    39  
    40  var _ InboundClient = ClosedTimestamp_GetServer(nil)