scope

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scope is defined to minimize specified generic types when call funcs Normally only one type(e.g. scope.TiKV/scope.TiKVGroup) need be specified when call any generic funcs

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Component

func Component[S Scheme]() string

func From

func From[
	S Object[F, T],
	F client.Object,
	T runtime.Object,
](f F) T

func GVK

func GetItems

func GetItems[
	S List[OL, O],
	OL client.ObjectList,
	O client.Object,
](l OL) []O

func NewList

func NewList[
	S List[OL, O],
	OL client.ObjectList,
	O client.Object,
]() OL

Types

type Backup

type Backup struct{}

func (Backup) Component

func (Backup) Component() string

func (Backup) From

func (Backup) From(f *v1alpha1.Backup) *runtime.Backup

func (Backup) GVK

func (Backup) NewList

func (Backup) NewList() client.ObjectList

func (Backup) To

type ClientObject

type ClientObject[T any] interface {
	client.Object
	*T
}

type Group

type Group[F client.Object, T runtime.Group] interface {
	Scheme
	From(F) T
	To(T) F
}

Group is a conversion between runtime group and api group runtime.Group <-> api.Group

type GroupInstance

type GroupInstance[
	GF client.Object,
	GT runtime.Group,
	IS any,
] interface {
	Group[GF, GT]
	Instance() IS
}

GroupInstance is defined to refer instance scope(IS) for - Instance: conversion from api.Instance to runtime.Instance - List: new api.InstanceList and get []api.Instance - InstanceList: both of the above

type GroupList

type GroupList[
	F client.Object,
	T runtime.Group,
	L client.ObjectList,
] interface {
	Group[F, T]
	List[L, F]
}

type Instance

type Instance[F client.Object, T runtime.Instance] interface {
	Scheme
	From(F) T
	To(T) F
}

Instance is a conversion between runtime instance and api instance runtime.Instance <-> api.Instance

type InstanceList

type InstanceList[
	F client.Object,
	T runtime.Instance,
	L client.ObjectList,
] interface {
	Instance[F, T]
	List[L, F]
}

type List

type List[
	L client.ObjectList,
	I client.Object,
] interface {
	NewList() L
	GetItems(L) []I
}

List defines an interface to refer api.ObjectList and api.Object type See apicall.ListInstances for how to use it

type Object

type Object[F client.Object, T runtime.Object] interface {
	Scheme
	From(F) T
	To(T) F
}

Object is a conversion between runtime object and api object runtime.Object <-> api.Object

type PD

type PD struct{}

func (PD) Component

func (PD) Component() string

func (PD) From

func (PD) From(f *v1alpha1.PD) *runtime.PD

func (PD) GVK

func (PD) GVK() schema.GroupVersionKind

func (PD) GetItems

func (PD) GetItems(l *v1alpha1.PDList) []*v1alpha1.PD

func (PD) NewList

func (PD) NewList() *v1alpha1.PDList

func (PD) To

func (PD) To(t *runtime.PD) *v1alpha1.PD

type PDGroup

type PDGroup struct{}

func (PDGroup) Component

func (PDGroup) Component() string

func (PDGroup) From

func (PDGroup) GVK

func (PDGroup) GetItems

func (PDGroup) GetItems(l *v1alpha1.PDGroupList) []*v1alpha1.PDGroup

func (PDGroup) Instance

func (PDGroup) Instance() PD

func (PDGroup) NewList

func (PDGroup) NewList() *v1alpha1.PDGroupList

func (PDGroup) To

type Restore

type Restore struct{}

func (Restore) Component

func (Restore) Component() string

func (Restore) From

func (Restore) GVK

func (Restore) NewList

func (Restore) NewList() client.ObjectList

func (Restore) To

type Scheduler

type Scheduler struct{}

func (Scheduler) Component

func (Scheduler) Component() string

func (Scheduler) From

func (Scheduler) GVK

func (Scheduler) GetItems

func (Scheduler) NewList

func (Scheduler) NewList() *v1alpha1.SchedulerList

func (Scheduler) To

type SchedulerGroup

type SchedulerGroup struct{}

func (SchedulerGroup) Component

func (SchedulerGroup) Component() string

func (SchedulerGroup) From

func (SchedulerGroup) GVK

func (SchedulerGroup) GetItems

func (SchedulerGroup) Instance

func (SchedulerGroup) Instance() Scheduler

func (SchedulerGroup) NewList

func (SchedulerGroup) To

type Scheduling

type Scheduling struct{}

func (Scheduling) Component

func (Scheduling) Component() string

func (Scheduling) From

func (Scheduling) GVK

func (Scheduling) GetItems

func (Scheduling) NewList

func (Scheduling) NewList() *v1alpha1.SchedulingList

func (Scheduling) To

type SchedulingGroup

type SchedulingGroup struct{}

func (SchedulingGroup) Component

func (SchedulingGroup) Component() string

func (SchedulingGroup) From

func (SchedulingGroup) GVK

func (SchedulingGroup) GetItems

func (SchedulingGroup) Instance

func (SchedulingGroup) Instance() Scheduling

func (SchedulingGroup) NewList

func (SchedulingGroup) To

type Scheme

type Scheme interface {
	Component() string
	GVK() schema.GroupVersionKind
}

type TSO

type TSO struct{}

func (TSO) Component

func (TSO) Component() string

func (TSO) From

func (TSO) From(f *v1alpha1.TSO) *runtime.TSO

func (TSO) GVK

func (TSO) GVK() schema.GroupVersionKind

func (TSO) GetItems

func (TSO) GetItems(l *v1alpha1.TSOList) []*v1alpha1.TSO

func (TSO) NewList

func (TSO) NewList() *v1alpha1.TSOList

func (TSO) To

func (TSO) To(t *runtime.TSO) *v1alpha1.TSO

type TSOGroup

type TSOGroup struct{}

func (TSOGroup) Component

func (TSOGroup) Component() string

func (TSOGroup) From

func (TSOGroup) GVK

func (TSOGroup) GetItems

func (TSOGroup) Instance

func (TSOGroup) Instance() TSO

func (TSOGroup) NewList

func (TSOGroup) NewList() *v1alpha1.TSOGroupList

func (TSOGroup) To

type TiCDC

type TiCDC struct{}

func (TiCDC) Component

func (TiCDC) Component() string

func (TiCDC) From

func (TiCDC) From(f *v1alpha1.TiCDC) *runtime.TiCDC

func (TiCDC) GVK

func (TiCDC) GetItems

func (TiCDC) GetItems(l *v1alpha1.TiCDCList) []*v1alpha1.TiCDC

func (TiCDC) NewList

func (TiCDC) NewList() *v1alpha1.TiCDCList

func (TiCDC) To

func (TiCDC) To(t *runtime.TiCDC) *v1alpha1.TiCDC

type TiCDCGroup

type TiCDCGroup struct{}

func (TiCDCGroup) Component

func (TiCDCGroup) Component() string

func (TiCDCGroup) From

func (TiCDCGroup) GVK

func (TiCDCGroup) GetItems

func (TiCDCGroup) Instance

func (TiCDCGroup) Instance() TiCDC

func (TiCDCGroup) NewList

func (TiCDCGroup) NewList() *v1alpha1.TiCDCGroupList

func (TiCDCGroup) To

type TiDB

type TiDB struct{}

func (TiDB) Component

func (TiDB) Component() string

func (TiDB) From

func (TiDB) From(f *v1alpha1.TiDB) *runtime.TiDB

func (TiDB) GVK

func (TiDB) GetItems

func (TiDB) GetItems(l *v1alpha1.TiDBList) []*v1alpha1.TiDB

func (TiDB) NewList

func (TiDB) NewList() *v1alpha1.TiDBList

func (TiDB) To

func (TiDB) To(t *runtime.TiDB) *v1alpha1.TiDB

type TiDBGroup

type TiDBGroup struct{}

func (TiDBGroup) Component

func (TiDBGroup) Component() string

func (TiDBGroup) From

func (TiDBGroup) GVK

func (TiDBGroup) GetItems

func (TiDBGroup) Instance

func (TiDBGroup) Instance() TiDB

func (TiDBGroup) NewList

func (TiDBGroup) NewList() *v1alpha1.TiDBGroupList

func (TiDBGroup) To

type TiFlash

type TiFlash struct{}

func (TiFlash) Component

func (TiFlash) Component() string

func (TiFlash) From

func (TiFlash) GVK

func (TiFlash) GetItems

func (TiFlash) GetItems(l *v1alpha1.TiFlashList) []*v1alpha1.TiFlash

func (TiFlash) NewList

func (TiFlash) NewList() *v1alpha1.TiFlashList

func (TiFlash) To

type TiFlashGroup

type TiFlashGroup struct{}

func (TiFlashGroup) Component

func (TiFlashGroup) Component() string

func (TiFlashGroup) From

func (TiFlashGroup) GVK

func (TiFlashGroup) GetItems

func (TiFlashGroup) Instance

func (TiFlashGroup) Instance() TiFlash

func (TiFlashGroup) NewList

func (TiFlashGroup) To

type TiKV

type TiKV struct{}

func (TiKV) Component

func (TiKV) Component() string

func (TiKV) From

func (TiKV) From(f *v1alpha1.TiKV) *runtime.TiKV

func (TiKV) GVK

func (TiKV) GetItems

func (TiKV) GetItems(l *v1alpha1.TiKVList) []*v1alpha1.TiKV

func (TiKV) NewList

func (TiKV) NewList() *v1alpha1.TiKVList

func (TiKV) To

func (TiKV) To(t *runtime.TiKV) *v1alpha1.TiKV

type TiKVGroup

type TiKVGroup struct{}

func (TiKVGroup) Component

func (TiKVGroup) Component() string

func (TiKVGroup) From

func (TiKVGroup) GVK

func (TiKVGroup) GetItems

func (TiKVGroup) Instance

func (TiKVGroup) Instance() TiKV

func (TiKVGroup) NewList

func (TiKVGroup) NewList() *v1alpha1.TiKVGroupList

func (TiKVGroup) To

type TiProxy

type TiProxy struct{}

func (TiProxy) Component

func (TiProxy) Component() string

func (TiProxy) From

func (TiProxy) GVK

func (TiProxy) GetItems

func (TiProxy) GetItems(l *v1alpha1.TiProxyList) []*v1alpha1.TiProxy

func (TiProxy) NewList

func (TiProxy) NewList() *v1alpha1.TiProxyList

func (TiProxy) To

type TiProxyGroup

type TiProxyGroup struct{}

func (TiProxyGroup) Component

func (TiProxyGroup) Component() string

func (TiProxyGroup) From

func (TiProxyGroup) GVK

func (TiProxyGroup) GetItems

func (TiProxyGroup) Instance

func (TiProxyGroup) Instance() TiProxy

func (TiProxyGroup) NewList

func (TiProxyGroup) To

Jump to

Keyboard shortcuts

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