service

package
v1.7.14 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Copyright (C) 2019-2024 vdaas.org vald team <vald@vdaas.org>

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

https://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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discovery

type Discovery interface {
	Start(ctx context.Context) (<-chan error, error)
}

Discovery represents an interface for the main logic of service discovery. The primary purpose of the Discovery interface is to reconcile custom resources, initiating or terminating gRPC connections based on the state of the custom resources.

func NewDiscovery

func NewDiscovery(opts ...DiscoveryOption) (dsc Discovery, err error)

NewDiscovery creates the Discovery object with optional configuration options. It returns the initialized Discovery object and an error if the creation process fails.

type DiscoveryOption

type DiscoveryOption func(d *discovery) error

DiscoveryOption represents the functional option for discovery.

func WithDiscoveryColocation

func WithDiscoveryColocation(loc string) DiscoveryOption

WithDiscoveryColocation returns the option to set the colocation name of datacenter.

func WithDiscoveryController

func WithDiscoveryController(ctrl k8s.Controller) DiscoveryOption

WithDiscoveryController returns the option to set the k8s controller.

func WithDiscoveryDialer

func WithDiscoveryDialer(der net.Dialer) DiscoveryOption

WithDiscoveryDialer returns the option to set the dialer for controller manager.

func WithDiscoveryDuration

func WithDiscoveryDuration(s string) DiscoveryOption

WithDiscoveryDuration returns the option to set the duration of the discovery.

func WithDiscoveryErrGroup

func WithDiscoveryErrGroup(eg errgroup.Group) DiscoveryOption

WithDiscoveryErrGroup returns the option to set the errgroup.

func WithDiscoveryGroup

func WithDiscoveryGroup(g string) DiscoveryOption

WithDiscoveryGroup returns the option to set the Mirror group for discovery.

func WithDiscoveryMirror

func WithDiscoveryMirror(m Mirror) DiscoveryOption

WithDiscoveryMirror returns the option to set the Mirror service.

func WithDiscoveryNamespace

func WithDiscoveryNamespace(ns string) DiscoveryOption

WithDiscoveryNamespace returns the option to set the namespace for discovery.

func WithDiscoverySelfMirrorAddrs

func WithDiscoverySelfMirrorAddrs(addrs ...string) DiscoveryOption

WithDiscoverySelfMirrorAddrs returns the option to set the self Mirror addresses.

type Gateway

type Gateway interface {
	FromForwardedContext(ctx context.Context) string
	BroadCast(ctx context.Context,
		f func(ctx context.Context, target string, vc MirrorClient, copts ...grpc.CallOption) error) error
	Do(ctx context.Context, target string,
		f func(ctx context.Context, target string, vc MirrorClient, copts ...grpc.CallOption) (any, error)) (any, error)
	DoMulti(ctx context.Context, targets []string,
		f func(ctx context.Context, target string, vc MirrorClient, copts ...grpc.CallOption) error) error
	GRPCClient() grpc.Client
}

Gateway represents an interface for interacting with gRPC clients.

func NewGateway

func NewGateway(opts ...Option) (Gateway, error)

NewGateway returns Gateway object if no error occurs.

type Mirror

type Mirror interface {
	Start(ctx context.Context) <-chan error
	Connect(ctx context.Context, targets ...*payload.Mirror_Target) error
	Disconnect(ctx context.Context, targets ...*payload.Mirror_Target) error
	IsConnected(ctx context.Context, addr string) bool
	MirrorTargets(ctx context.Context) ([]*payload.Mirror_Target, error)
	RangeMirrorAddr(f func(addr string, _ any) bool)
}

Mirror represents an interface for managing mirroring operations. It provides methods for starting the mirroring service, connecting and disconnecting targets, checking the connectivity status of a given address, checking the existence of an address, retrieving all mirror targets, and iterating over all mirror addresses.

func NewMirror

func NewMirror(opts ...MirrorOption) (_ Mirror, err error)

NewMirror creates the Mirror object with optional configuration options. It returns the initialized Mirror object and an error if the creation process fails.

type MirrorClient added in v1.7.12

type MirrorClient interface {
	vald.Client
	mirror.MirrorClient
}

func NewMirrorClient added in v1.7.12

func NewMirrorClient(conn *grpc.ClientConn) MirrorClient

type MirrorOption

type MirrorOption func(m *mirr) error

MirrorOption represents the functional option for mirror.

func WithErrorGroup

func WithErrorGroup(eg errgroup.Group) MirrorOption

WithErrorGroup returns the option to set the error group.

func WithGateway

func WithGateway(g Gateway) MirrorOption

WithGateway returns the option to set the Gateway service.

func WithGatewayAddrs

func WithGatewayAddrs(addrs ...string) MirrorOption

WithGatewayAddrs returns the option to set the gateway addresses.

func WithRegisterDuration

func WithRegisterDuration(s string) MirrorOption

WithRegisterDuration returns the option to set the register duration.

func WithSelfMirrorAddrs

func WithSelfMirrorAddrs(addrs ...string) MirrorOption

WithSelfMirrorAddrs returns the option to set the self Mirror gateway addresses.

type Option

type Option func(g *gateway) error

Option represents the functional option for gateway.

func WithErrGroup

func WithErrGroup(eg errgroup.Group) Option

WithErrGroup returns the option to set the error group.

func WithMirrorClient

func WithMirrorClient(c mirror.Client) Option

WithMirrorClient returns the option to set the Mirror client.

func WithPodName

func WithPodName(s string) Option

WithPodName returns the option to set the pod name.

Jump to

Keyboard shortcuts

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