Documentation ¶
Index ¶
- Constants
- Variables
- func CtxWithTx(ctx context.Context, tx Transaction) context.Context
- func ErrorResourceAlreadyExists(rt model.ResourceType, name, mesh string) error
- func ErrorResourceAssertion(msg string, rt model.ResourceType, name, mesh string) error
- func ErrorResourceConflict(rt model.ResourceType, name, mesh string) error
- func ErrorResourceNotFound(rt model.ResourceType, name, mesh string) error
- func InTx(ctx context.Context, transactions Transactions, ...) error
- func IsResourceNotFound(err error) bool
- type AssertionError
- type ClosableResourceStore
- type CreateOptions
- type CreateOptionsFunc
- func CreateBy(key core_model.ResourceKey) CreateOptionsFunc
- func CreateByApplication(app string) CreateOptionsFunc
- func CreateByID(id string) CreateOptionsFunc
- func CreateByKey(name, mesh string) CreateOptionsFunc
- func CreateByPath(path string) CreateOptionsFunc
- func CreateByService(service string) CreateOptionsFunc
- func CreateByServiceGroup(serviceGroup string) CreateOptionsFunc
- func CreateByServiceVersion(serviceVersion string) CreateOptionsFunc
- func CreateWithLabels(labels map[string]string) CreateOptionsFunc
- func CreateWithOwner(owner core_model.Resource) CreateOptionsFunc
- func CreatedAt(creationTime time.Time) CreateOptionsFunc
- type CustomizableResourceStore
- type DeleteAllOptions
- type DeleteAllOptionsFunc
- type DeleteOptions
- type DeleteOptionsFunc
- func DeleteBy(key core_model.ResourceKey) DeleteOptionsFunc
- func DeleteByApplication(app string) DeleteOptionsFunc
- func DeleteByID(id string) DeleteOptionsFunc
- func DeleteByKey(name, mesh string) DeleteOptionsFunc
- func DeleteByPath(path string) DeleteOptionsFunc
- func DeleteByService(service string) DeleteOptionsFunc
- func DeleteByServiceGroup(serviceGroup string) DeleteOptionsFunc
- func DeleteByServiceVersion(serviceVersion string) DeleteOptionsFunc
- type GetOptions
- type GetOptionsFunc
- func GetBy(key core_model.ResourceKey) GetOptionsFunc
- func GetByApplication(app string) GetOptionsFunc
- func GetByID(id string) GetOptionsFunc
- func GetByKey(name, mesh string) GetOptionsFunc
- func GetByPath(path string) GetOptionsFunc
- func GetByRevision(revision string) GetOptionsFunc
- func GetByService(service string) GetOptionsFunc
- func GetByServiceGroup(serviceGroup string) GetOptionsFunc
- func GetByServiceVersion(serviceVersion string) GetOptionsFunc
- func GetByType(t string) GetOptionsFunc
- func GetByVersion(version string) GetOptionsFunc
- func GetConsistent() GetOptionsFunc
- type ListFilterFunc
- type ListOptions
- type ListOptionsFunc
- func ListByApplication(app string) ListOptionsFunc
- func ListByApplicationContains(app string) ListOptionsFunc
- func ListByFilterFunc(filterFunc ListFilterFunc) ListOptionsFunc
- func ListByMesh(mesh string) ListOptionsFunc
- func ListByNameContains(name string) ListOptionsFunc
- func ListByNameEquals(name string) ListOptionsFunc
- func ListByPage(size int, offset string) ListOptionsFunc
- func ListByPath(path string) ListOptionsFunc
- func ListByResourceKeys(rk []core_model.ResourceKey) ListOptionsFunc
- func ListOrdered() ListOptionsFunc
- type NoTransactions
- type NoopTransaction
- type PreconditionError
- type ResourceConflictError
- type ResourceStore
- type ResourceStoreWrapper
- type Transaction
- type Transactions
- type UpdateOptions
- type UpdateOptionsFunc
- func ModifiedAt(modificationTime time.Time) UpdateOptionsFunc
- func UpdateByApplication(app string) UpdateOptionsFunc
- func UpdateByID(id string) UpdateOptionsFunc
- func UpdateByKey(name, mesh string) UpdateOptionsFunc
- func UpdateByService(service string) UpdateOptionsFunc
- func UpdateByServiceGroup(serviceGroup string) UpdateOptionsFunc
- func UpdateByServiceVersion(serviceVersion string) UpdateOptionsFunc
- func UpdateWithLabels(labels map[string]string) UpdateOptionsFunc
- func UpdateWithPath(path string) UpdateOptionsFunc
Constants ¶
const (
PathLabel = "dubbo.io/path"
)
Variables ¶
var ErrorInvalidOffset = errors.New("invalid offset")
Functions ¶
func ErrorResourceAlreadyExists ¶
func ErrorResourceAlreadyExists(rt model.ResourceType, name, mesh string) error
func ErrorResourceAssertion ¶
func ErrorResourceAssertion(msg string, rt model.ResourceType, name, mesh string) error
func ErrorResourceConflict ¶
func ErrorResourceConflict(rt model.ResourceType, name, mesh string) error
func ErrorResourceNotFound ¶
func ErrorResourceNotFound(rt model.ResourceType, name, mesh string) error
func IsResourceNotFound ¶
Types ¶
type AssertionError ¶
type AssertionError struct {
// contains filtered or unexported fields
}
AssertionError
func (*AssertionError) Error ¶
func (e *AssertionError) Error() string
func (*AssertionError) Is ¶
func (e *AssertionError) Is(err error) bool
func (*AssertionError) Unwrap ¶
func (e *AssertionError) Unwrap() error
type ClosableResourceStore ¶
type ClosableResourceStore interface { ResourceStore io.Closer }
func NewStrictResourceStore ¶
func NewStrictResourceStore(c ResourceStore) ClosableResourceStore
type CreateOptions ¶
type CreateOptions struct { Name string Mesh string CreationTime time.Time Owner core_model.Resource Labels map[string]string }
func NewCreateOptions ¶
func NewCreateOptions(fs ...CreateOptionsFunc) *CreateOptions
type CreateOptionsFunc ¶
type CreateOptionsFunc func(*CreateOptions)
func CreateBy ¶
func CreateBy(key core_model.ResourceKey) CreateOptionsFunc
func CreateByApplication ¶
func CreateByApplication(app string) CreateOptionsFunc
func CreateByID ¶
func CreateByID(id string) CreateOptionsFunc
func CreateByKey ¶
func CreateByKey(name, mesh string) CreateOptionsFunc
func CreateByPath ¶
func CreateByPath(path string) CreateOptionsFunc
func CreateByService ¶
func CreateByService(service string) CreateOptionsFunc
func CreateByServiceGroup ¶
func CreateByServiceGroup(serviceGroup string) CreateOptionsFunc
func CreateByServiceVersion ¶
func CreateByServiceVersion(serviceVersion string) CreateOptionsFunc
func CreateWithLabels ¶
func CreateWithLabels(labels map[string]string) CreateOptionsFunc
func CreateWithOwner ¶
func CreateWithOwner(owner core_model.Resource) CreateOptionsFunc
func CreatedAt ¶
func CreatedAt(creationTime time.Time) CreateOptionsFunc
type CustomizableResourceStore ¶
type CustomizableResourceStore interface { ResourceStore ResourceStore(typ model.ResourceType) ResourceStore DefaultResourceStore() ResourceStore Customize(typ model.ResourceType, store ResourceStore) WrapAll(wrapper ResourceStoreWrapper) }
func NewCustomizableResourceStore ¶
func NewCustomizableResourceStore(defaultStore ResourceStore) CustomizableResourceStore
type DeleteAllOptions ¶
type DeleteAllOptions struct {
Mesh string
}
func NewDeleteAllOptions ¶
func NewDeleteAllOptions(fs ...DeleteAllOptionsFunc) *DeleteAllOptions
type DeleteAllOptionsFunc ¶
type DeleteAllOptionsFunc func(*DeleteAllOptions)
func DeleteAllByMesh ¶
func DeleteAllByMesh(mesh string) DeleteAllOptionsFunc
type DeleteOptions ¶
func NewDeleteOptions ¶
func NewDeleteOptions(fs ...DeleteOptionsFunc) *DeleteOptions
type DeleteOptionsFunc ¶
type DeleteOptionsFunc func(*DeleteOptions)
func DeleteBy ¶
func DeleteBy(key core_model.ResourceKey) DeleteOptionsFunc
func DeleteByApplication ¶
func DeleteByApplication(app string) DeleteOptionsFunc
func DeleteByID ¶
func DeleteByID(id string) DeleteOptionsFunc
func DeleteByKey ¶
func DeleteByKey(name, mesh string) DeleteOptionsFunc
func DeleteByPath ¶
func DeleteByPath(path string) DeleteOptionsFunc
func DeleteByService ¶
func DeleteByService(service string) DeleteOptionsFunc
func DeleteByServiceGroup ¶
func DeleteByServiceGroup(serviceGroup string) DeleteOptionsFunc
func DeleteByServiceVersion ¶
func DeleteByServiceVersion(serviceVersion string) DeleteOptionsFunc
type GetOptions ¶
type GetOptions struct { Name string Mesh string Version string Type string Consistent bool Labels map[string]string }
func NewGetOptions ¶
func NewGetOptions(fs ...GetOptionsFunc) *GetOptions
func (*GetOptions) HashCode ¶
func (g *GetOptions) HashCode() string
func (*GetOptions) Predicate ¶
func (l *GetOptions) Predicate(r core_model.Resource) bool
type GetOptionsFunc ¶
type GetOptionsFunc func(*GetOptions)
func GetBy ¶
func GetBy(key core_model.ResourceKey) GetOptionsFunc
func GetByApplication ¶
func GetByApplication(app string) GetOptionsFunc
func GetByID ¶
func GetByID(id string) GetOptionsFunc
func GetByKey ¶
func GetByKey(name, mesh string) GetOptionsFunc
func GetByPath ¶
func GetByPath(path string) GetOptionsFunc
func GetByRevision ¶
func GetByRevision(revision string) GetOptionsFunc
func GetByService ¶
func GetByService(service string) GetOptionsFunc
func GetByServiceGroup ¶
func GetByServiceGroup(serviceGroup string) GetOptionsFunc
func GetByServiceVersion ¶
func GetByServiceVersion(serviceVersion string) GetOptionsFunc
func GetByType ¶
func GetByType(t string) GetOptionsFunc
func GetByVersion ¶
func GetByVersion(version string) GetOptionsFunc
func GetConsistent ¶
func GetConsistent() GetOptionsFunc
GetConsistent forces consistency if storage provides eventual consistency like read replica for Postgres.
type ListFilterFunc ¶
type ListFilterFunc func(rs core_model.Resource) bool
type ListOptions ¶
type ListOptions struct { Mesh string Labels map[string]string PageSize int PageOffset string FilterFunc ListFilterFunc NameContains string NameEquals string ApplicationContains string Ordered bool ResourceKeys map[core_model.ResourceKey]struct{} }
func NewListOptions ¶
func NewListOptions(fs ...ListOptionsFunc) *ListOptions
func (*ListOptions) Filter ¶
func (l *ListOptions) Filter(rs core_model.Resource) bool
Filter returns true if the item passes the filtering criteria
func (*ListOptions) HashCode ¶
func (l *ListOptions) HashCode() string
func (*ListOptions) IsCacheable ¶
func (l *ListOptions) IsCacheable() bool
func (*ListOptions) Predicate ¶
func (l *ListOptions) Predicate(r core_model.Resource) bool
type ListOptionsFunc ¶
type ListOptionsFunc func(*ListOptions)
func ListByApplication ¶
func ListByApplication(app string) ListOptionsFunc
func ListByApplicationContains ¶
func ListByApplicationContains(app string) ListOptionsFunc
func ListByFilterFunc ¶
func ListByFilterFunc(filterFunc ListFilterFunc) ListOptionsFunc
func ListByMesh ¶
func ListByMesh(mesh string) ListOptionsFunc
func ListByNameContains ¶
func ListByNameContains(name string) ListOptionsFunc
func ListByNameEquals ¶
func ListByNameEquals(name string) ListOptionsFunc
func ListByPage ¶
func ListByPage(size int, offset string) ListOptionsFunc
func ListByPath ¶
func ListByPath(path string) ListOptionsFunc
func ListByResourceKeys ¶
func ListByResourceKeys(rk []core_model.ResourceKey) ListOptionsFunc
func ListOrdered ¶
func ListOrdered() ListOptionsFunc
type NoTransactions ¶
type NoTransactions struct{}
func (NoTransactions) Begin ¶
func (n NoTransactions) Begin(context.Context) (Transaction, error)
type NoopTransaction ¶
type NoopTransaction struct{}
type PreconditionError ¶
type PreconditionError struct {
Reason string
}
func PreconditionFormatError ¶
func PreconditionFormatError(reason string) *PreconditionError
func (*PreconditionError) Error ¶
func (a *PreconditionError) Error() string
func (*PreconditionError) Is ¶
func (a *PreconditionError) Is(err error) bool
type ResourceConflictError ¶
type ResourceConflictError struct {
// contains filtered or unexported fields
}
func (*ResourceConflictError) Error ¶
func (e *ResourceConflictError) Error() string
func (*ResourceConflictError) Is ¶
func (e *ResourceConflictError) Is(err error) bool
type ResourceStore ¶
type ResourceStore interface { Create(context.Context, model.Resource, ...CreateOptionsFunc) error Update(context.Context, model.Resource, ...UpdateOptionsFunc) error Delete(context.Context, model.Resource, ...DeleteOptionsFunc) error Get(context.Context, model.Resource, ...GetOptionsFunc) error List(context.Context, model.ResourceList, ...ListOptionsFunc) error }
func NewPaginationStore ¶
func NewPaginationStore(delegate ResourceStore) ResourceStore
The Pagination Store is handling only the pagination functionality in the List. This is an in-memory operation and offloads this from the persistent stores (k8s, postgres etc.) Two reasons why this is needed: * There is no filtering + pagination on the native K8S database * On Postgres, we keep the object in a column as a string. We would have to use JSON column type and convert it to native SQL queries.
The in-memory filtering has been tested with 10,000 Dataplanes and proved to be fast enough, although not that efficient.
type ResourceStoreWrapper ¶
type ResourceStoreWrapper = func(delegate ResourceStore) ResourceStore
ResourceStoreWrapper is a function that takes a ResourceStore and returns a wrapped ResourceStore. The wrapped ResourceStore can be used to modify or augment the behavior of the original ResourceStore.
type Transaction ¶
type Transactions ¶
type Transactions interface {
Begin(ctx context.Context) (Transaction, error)
}
Transactions is a producer of transactions if a resource store support transactions. Transactions are never required for consistency in dubbo, because there are ResourceStores that does not support transactions. However, in a couple of cases executing queries in transaction can improve the performance.
In case of Postgres, you may set hooks when retrieve and release connections for the connection pool. In this case, if you create multiple resources, you need to acquire connection and execute hooks for each create. If you create transaction for it, you execute hooks once and you hold the connection.
Transaction is propagated implicitly through Context.
type UpdateOptions ¶
type UpdateOptions struct { Name string Mesh string ModificationTime time.Time Labels map[string]string }
func NewUpdateOptions ¶
func NewUpdateOptions(fs ...UpdateOptionsFunc) *UpdateOptions
type UpdateOptionsFunc ¶
type UpdateOptionsFunc func(*UpdateOptions)
func ModifiedAt ¶
func ModifiedAt(modificationTime time.Time) UpdateOptionsFunc
func UpdateByApplication ¶
func UpdateByApplication(app string) UpdateOptionsFunc
func UpdateByID ¶
func UpdateByID(id string) UpdateOptionsFunc
func UpdateByKey ¶
func UpdateByKey(name, mesh string) UpdateOptionsFunc
func UpdateByService ¶
func UpdateByService(service string) UpdateOptionsFunc
func UpdateByServiceGroup ¶
func UpdateByServiceGroup(serviceGroup string) UpdateOptionsFunc
func UpdateByServiceVersion ¶
func UpdateByServiceVersion(serviceVersion string) UpdateOptionsFunc
func UpdateWithLabels ¶
func UpdateWithLabels(labels map[string]string) UpdateOptionsFunc
func UpdateWithPath ¶
func UpdateWithPath(path string) UpdateOptionsFunc