agollo

package
v1.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 12 Imported by: 0

README

Example

package agollo

import (
	"context"

	"github.com/air-go/rpc/library/apollo/listener"
	"github.com/air-go/rpc/library/apollo/listener/structlistener"
)

type Conf struct {
	Key string
}

func TestNew(t *testing.T) {
	conf := &Conf{}
	listeners := []listener.CustomListener{
		{
			NamespaceStruct: map[string]interface{}{
				"test.json": conf,
			},
			CustomListener: &structlistener.StructChangeListener{},
		},
	}
	New(context.Background(), "test", []string{"test.json"}, WithCustomListeners(listeners))
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, appID, ip, cluster string, namespaces []string, opts ...Option) (err error)

func SetBackupFileHandler

func SetBackupFileHandler(f file.FileHandler)

SetBackupFileHandler set custom backup file handler

func SetCacheFactory

func SetCacheFactory(f agcache.CacheFactory)

SetCache set custom cache factory

func SetLoadBalance

func SetLoadBalance(l cluster.LoadBalance)

SetLoadBalance set custom load balance

func SetLogger

func SetLogger(l log.LoggerInterface)

SetLogger set custom logger

func SetSignature

func SetSignature(a auth.HTTPAuth)

SetSignature set custom http auth

Types

type ApolloClient

type ApolloClient struct {
	// contains filtered or unexported fields
}

type Option

type Option func(*ApolloClient)

func WithBackupConfigPath

func WithBackupConfigPath(backupPath string) Option

func WithCustomListeners

func WithCustomListeners(listeners []listener.Listener) Option

func WithIsBackupConfig

func WithIsBackupConfig(isBackup bool) Option

func WithSecret

func WithSecret(secret string) Option

func WithSyncServerTimeout

func WithSyncServerTimeout(syncServerTimeout int) Option

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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