coordination

package
v3.42.6-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2023 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Overview

Example
ctx := context.TODO()
db, err := ydb.Open(ctx, "grpcs://localhost:2135/local")
if err != nil {
	fmt.Printf("failed to connect: %v", err)
	return
}
defer db.Close(ctx) // cleanup resources
// create node
err = db.Coordination().CreateNode(ctx, "/local/test", coordination.NodeConfig{
	Path:                     "",
	SelfCheckPeriodMillis:    1000,
	SessionGracePeriodMillis: 1000,
	ReadConsistencyMode:      coordination.ConsistencyModeRelaxed,
	AttachConsistencyMode:    coordination.ConsistencyModeRelaxed,
	RatelimiterCountersMode:  coordination.RatelimiterCountersModeDetailed,
})
if err != nil {
	fmt.Printf("failed to create node: %v", err)
	return
}
defer db.Coordination().DropNode(ctx, "/local/test")
e, c, err := db.Coordination().DescribeNode(ctx, "/local/test")
if err != nil {
	fmt.Printf("failed to describe node: %v", err)
	return
}
fmt.Printf("node description: %+v\nnode config: %+v\n", e, c)
Output:

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client added in v3.7.0

type Client interface {
	CreateNode(ctx context.Context, path string, config NodeConfig) (err error)
	AlterNode(ctx context.Context, path string, config NodeConfig) (err error)
	DropNode(ctx context.Context, path string) (err error)
	DescribeNode(ctx context.Context, path string) (_ *scheme.Entry, _ *NodeConfig, err error)
}

type ConsistencyMode

type ConsistencyMode uint
const (
	ConsistencyModeUnset ConsistencyMode = iota
	ConsistencyModeStrict
	ConsistencyModeRelaxed
)

func (ConsistencyMode) String

func (t ConsistencyMode) String() string

func (ConsistencyMode) To

type NodeConfig added in v3.10.0

type NodeConfig struct {
	Path                     string
	SelfCheckPeriodMillis    uint32
	SessionGracePeriodMillis uint32
	ReadConsistencyMode      ConsistencyMode
	AttachConsistencyMode    ConsistencyMode
	RatelimiterCountersMode  RatelimiterCountersMode
}

type RatelimiterCountersMode added in v3.7.0

type RatelimiterCountersMode uint
const (
	RatelimiterCountersModeUnset RatelimiterCountersMode = iota
	RatelimiterCountersModeAggregated
	RatelimiterCountersModeDetailed
)

func (RatelimiterCountersMode) String added in v3.7.0

func (t RatelimiterCountersMode) String() string

func (RatelimiterCountersMode) To added in v3.7.0

Jump to

Keyboard shortcuts

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