indextest

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2026 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package indextest provides a test double for index.Index.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index struct {
	// Clusters maps a logical cluster to the name of the shard hosting it.
	Clusters map[logicalcluster.Name]string
	// Shards maps a shard name to its base URL.
	Shards map[string]string
	// RecentlyMigratedClusters are the clusters RecentlyMigrated reports.
	RecentlyMigratedClusters map[logicalcluster.Name]bool

	// Registered and Released count the ClusterContext calls and the
	// calls of the cancel functions they returned.
	Registered atomic.Int32
	Released   atomic.Int32
}

Index is a map-based index.Index: it maps logical clusters to shards and shards to base URLs. Lookups resolve logical cluster names only, not workspace paths. The maps must not be changed once the Index is in use.

func (*Index) BaseURL

func (f *Index) BaseURL(shardName string) (string, bool)

BaseURL returns the base URL of the shard.

func (*Index) ClusterContext

func (f *Index) ClusterContext(parent context.Context, cluster logicalcluster.Name) (context.Context, context.CancelFunc)

ClusterContext returns a cancellable child of parent and counts the registration and its release.

func (*Index) Lookup

func (f *Index) Lookup(path logicalcluster.Path) (index.Result, bool)

Lookup returns the shard hosting the cluster, with the cluster's URL on that shard.

func (*Index) LookupURL

func (f *Index) LookupURL(path logicalcluster.Path) (index.Result, bool)

LookupURL is Lookup: the fake knows no mounts.

func (*Index) RecentlyMigrated

func (f *Index) RecentlyMigrated(cluster logicalcluster.Name) bool

RecentlyMigrated reports whether the cluster is in RecentlyMigratedClusters.

Jump to

Keyboard shortcuts

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