tagging

package module
v0.0.0-...-19f1bc5 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

README

Tagging Loadbalance

Divide the cluster into different subsets based on tags on the client, suitable for stateful services or multi-tenant services

How to use?

Client

import (
	...
	"github.com/cloudwego/kitex/client"
	tagging "github.com/kitex-contrib/loadbalance-tagging"
	...
)

func main() {
	...
	// create a LoadBalancer with loadbalance 
	client, err := client.NewClient("echo", client.WithLoadBalancer(tagging.New(tag, tagFunc, nextLoadBalancer)))
	if err != nil {
		log.Fatal(err)
	}
	...
}

Multi-tag selector can be implemented by combining tag selectors in sequence

import (
	...
	"github.com/cloudwego/kitex/client"
	tagging "github.com/kitex-contrib/loadbalance-tagging"
	...
)

func main() {
	... 
	// create a LoadBalancer with multi-tag selectors 
	client, err := client.NewClient("echo", 
		client.WithLoadBalancer(tagging.New(tag1, tag1Func, tagging.New(tag2, tag2Func, nextLoadBalancer))))
	if err != nil {
		log.Fatal(err)
	}
	...
}

Maintainer

maintained by: jizhuozhi (jizhuozhi.george@gmail.com)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type TagFunc

type TagFunc func(ctx context.Context, request interface{}) string

Jump to

Keyboard shortcuts

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