watcher

package
v0.0.0-...-e165f0f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Change_State_name = map[int32]string{
	0: "EXISTS",
	1: "DOES_NOT_EXIST",
	2: "INITIAL_STATE_SKIPPED",
	3: "ERROR",
}
View Source
var Change_State_value = map[string]int32{
	"EXISTS":                0,
	"DOES_NOT_EXIST":        1,
	"INITIAL_STATE_SKIPPED": 2,
	"ERROR":                 3,
}

Functions

func RegisterWatcherServer

func RegisterWatcherServer(s *grpc.Server, srv WatcherServer)

Types

type Change

type Change struct {
	// Name of the element, interpreted relative to the entity's actual
	// name. "" refers to the entity itself. The element name is a valid
	// UTF-8 string.
	Element string `protobuf:"bytes,1,opt,name=element,proto3" json:"element,omitempty"`
	// The state of the `element`.
	State Change_State `protobuf:"varint,2,opt,name=state,proto3,enum=google.watcher.v1.Change_State" json:"state,omitempty"`
	// The actual change data. This field is present only when `state() == EXISTS`
	// or `state() == ERROR`. Please see
	// [google.protobuf.Any][google.protobuf.Any] about how to use the Any type.
	Data *any.Any `protobuf:"bytes,6,opt,name=data,proto3" json:"data,omitempty"`
	// If present, provides a compact representation of all the messages that have
	// been received by the caller for the given entity, e.g., it could be a
	// sequence number or a multi-part timestamp/version vector. This marker can
	// be provided in the Request message, allowing the caller to resume the
	// stream watching at a specific point without fetching the initial state.
	ResumeMarker []byte `protobuf:"bytes,4,opt,name=resume_marker,json=resumeMarker,proto3" json:"resume_marker,omitempty"`
	// If true, this Change is followed by more Changes that are in the same group
	// as this Change.
	Continued            bool     `protobuf:"varint,5,opt,name=continued,proto3" json:"continued,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

A Change indicates the most recent state of an element.

func (*Change) Descriptor

func (*Change) Descriptor() ([]byte, []int)

func (*Change) GetContinued

func (m *Change) GetContinued() bool

func (*Change) GetData

func (m *Change) GetData() *any.Any

func (*Change) GetElement

func (m *Change) GetElement() string

func (*Change) GetResumeMarker

func (m *Change) GetResumeMarker() []byte

func (*Change) GetState

func (m *Change) GetState() Change_State

func (*Change) ProtoMessage

func (*Change) ProtoMessage()

func (*Change) Reset

func (m *Change) Reset()

func (*Change) String

func (m *Change) String() string

func (*Change) XXX_DiscardUnknown

func (m *Change) XXX_DiscardUnknown()

func (*Change) XXX_Marshal

func (m *Change) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Change) XXX_Merge

func (m *Change) XXX_Merge(src proto.Message)

func (*Change) XXX_Size

func (m *Change) XXX_Size() int

func (*Change) XXX_Unmarshal

func (m *Change) XXX_Unmarshal(b []byte) error

type ChangeBatch

type ChangeBatch struct {
	// A list of Change messages.
	Changes              []*Change `protobuf:"bytes,1,rep,name=changes,proto3" json:"changes,omitempty"`
	XXX_NoUnkeyedLiteral struct{}  `json:"-"`
	XXX_unrecognized     []byte    `json:"-"`
	XXX_sizecache        int32     `json:"-"`
}

A batch of Change messages.

func (*ChangeBatch) Descriptor

func (*ChangeBatch) Descriptor() ([]byte, []int)

func (*ChangeBatch) GetChanges

func (m *ChangeBatch) GetChanges() []*Change

func (*ChangeBatch) ProtoMessage

func (*ChangeBatch) ProtoMessage()

func (*ChangeBatch) Reset

func (m *ChangeBatch) Reset()

func (*ChangeBatch) String

func (m *ChangeBatch) String() string

func (*ChangeBatch) XXX_DiscardUnknown

func (m *ChangeBatch) XXX_DiscardUnknown()

func (*ChangeBatch) XXX_Marshal

func (m *ChangeBatch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChangeBatch) XXX_Merge

func (m *ChangeBatch) XXX_Merge(src proto.Message)

func (*ChangeBatch) XXX_Size

func (m *ChangeBatch) XXX_Size() int

func (*ChangeBatch) XXX_Unmarshal

func (m *ChangeBatch) XXX_Unmarshal(b []byte) error

type Change_State

type Change_State int32

A reported value can be in one of the following states:

const (
	// The element exists and its full value is included in data.
	Change_EXISTS Change_State = 0
	// The element does not exist.
	Change_DOES_NOT_EXIST Change_State = 1
	// Element may or may not exist. Used only for initial state delivery when
	// the client is not interested in fetching the initial state. See the
	// "Initial State" section above.
	Change_INITIAL_STATE_SKIPPED Change_State = 2
	// The element may exist, but some error has occurred. More information is
	// available in the data field - the value is a serialized Status
	// proto (from [google.rpc.Status][])
	Change_ERROR Change_State = 3
)

func (Change_State) EnumDescriptor

func (Change_State) EnumDescriptor() ([]byte, []int)

func (Change_State) String

func (x Change_State) String() string

type Request

type Request struct {
	// The `target` value **must** be a valid URL path pointing to an entity
	// to watch. Note that the service name **must** be
	// removed from the target field (e.g., the target field must say
	// "/foo/bar", not "myservice.googleapis.com/foo/bar"). A client is
	// also allowed to pass system-specific parameters in the URL that
	// are only obeyed by some implementations. Some parameters will be
	// implementation-specific. However, some have predefined meaning
	// and are listed here:
	//
	//  * recursive = true|false [default=false]
	//    If set to true, indicates that the client wants to watch all elements
	//    of entities in the subtree rooted at the entity's name in `target`. For
	//    descendants that are not the immediate children of the target, the
	//    `Change.element` will contain slashes.
	//
	//    Note that some namespaces and entities will not support recursive
	//    watching. When watching such an entity, a client must not set recursive
	//    to true. Otherwise, it will receive an `UNIMPLEMENTED` error.
	//
	// Normal URL encoding must be used inside `target`.  For example, if a query
	// parameter name or value, or the non-query parameter portion of `target`
	// contains a special character, it must be %-encoded.  We recommend that
	// clients and servers use their runtime's URL library to produce and consume
	// target values.
	Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"`
	// The `resume_marker` specifies how much of the existing underlying state is
	// delivered to the client when the watch request is received by the
	// system. The client can set this marker in one of the following ways to get
	// different semantics:
	//
	// *   Parameter is not specified or has the value "".
	//     Semantics: Fetch initial state.
	//     The client wants the entity's initial state to be delivered. See the
	//     description in "Initial State".
	//
	// *   Parameter is set to the string "now" (UTF-8 encoding).
	//     Semantics: Fetch new changes only.
	//     The client just wants to get the changes received by the system after
	//     the watch point. The system may deliver changes from before the watch
	//     point as well.
	//
	// *   Parameter is set to a value received in an earlier
	//     `Change.resume_marker` field while watching the same entity.
	//     Semantics: Resume from a specific point.
	//     The client wants to receive the changes from a specific point; this
	//     value must correspond to a value received in the `Change.resume_marker`
	//     field. The system may deliver changes from before the `resume_marker`
	//     as well. If the system cannot resume the stream from this point (e.g.,
	//     if it is too far behind in the stream), it can raise the
	//     `FAILED_PRECONDITION` error.
	//
	// An implementation MUST support an unspecified parameter and the
	// empty string "" marker (initial state fetching) and the "now" marker.
	// It need not support resuming from a specific point.
	ResumeMarker         []byte   `protobuf:"bytes,2,opt,name=resume_marker,json=resumeMarker,proto3" json:"resume_marker,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

The message used by the client to register interest in an entity.

func (*Request) Descriptor

func (*Request) Descriptor() ([]byte, []int)

func (*Request) GetResumeMarker

func (m *Request) GetResumeMarker() []byte

func (*Request) GetTarget

func (m *Request) GetTarget() string

func (*Request) ProtoMessage

func (*Request) ProtoMessage()

func (*Request) Reset

func (m *Request) Reset()

func (*Request) String

func (m *Request) String() string

func (*Request) XXX_DiscardUnknown

func (m *Request) XXX_DiscardUnknown()

func (*Request) XXX_Marshal

func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Request) XXX_Merge

func (m *Request) XXX_Merge(src proto.Message)

func (*Request) XXX_Size

func (m *Request) XXX_Size() int

func (*Request) XXX_Unmarshal

func (m *Request) XXX_Unmarshal(b []byte) error

type UnimplementedWatcherServer

type UnimplementedWatcherServer struct {
}

UnimplementedWatcherServer can be embedded to have forward compatible implementations.

func (*UnimplementedWatcherServer) Watch

type WatcherClient

type WatcherClient interface {
	// Start a streaming RPC to get watch information from the server.
	Watch(ctx context.Context, in *Request, opts ...grpc.CallOption) (Watcher_WatchClient, error)
}

WatcherClient is the client API for Watcher service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewWatcherClient

func NewWatcherClient(cc grpc.ClientConnInterface) WatcherClient

type WatcherServer

type WatcherServer interface {
	// Start a streaming RPC to get watch information from the server.
	Watch(*Request, Watcher_WatchServer) error
}

WatcherServer is the server API for Watcher service.

type Watcher_WatchClient

type Watcher_WatchClient interface {
	Recv() (*ChangeBatch, error)
	grpc.ClientStream
}

type Watcher_WatchServer

type Watcher_WatchServer interface {
	Send(*ChangeBatch) error
	grpc.ServerStream
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL