provider

package
v0.0.0-...-ec63eb9 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var EFetchFlagDetails = status.Error(
	codes.Internal,
	"error occurred while fetching flag details",
)

EFetchFlagDetails is a GRPC error that is returned when an unknown error occurs while fetching flag details.

View Source
var EIncorrectFlagDetailCount = status.Error(
	codes.Internal,
	"an unexpected number of flags were found",
)

EIncorrectFlagDetailCount is a GRPC error that is returned when the number of flag details does not match the expected count.

View Source
var EStatusCache = status.Error(
	codes.Internal,
	"error occurred while checking flag status cache",
)

EStatusCache is a GRPC error that is returned when an error has occurred while checking the cache for the flag status.

Functions

func NewProviderCacheRepository

func NewProviderCacheRepository(rdb *redis.Client) *providerCacheRepository

func NewProviderRepository

func NewProviderRepository(db *mongo.Database) *providerRepository

Types

type FlagDetails

type FlagDetails struct {
	ID          primitive.ObjectID      `bson:"_id"`
	Key         string                  `bson:"key"`
	Name        string                  `bson:"name"`
	Environment environment.Environment `bson:"environment"`
	Flag        flag.Flag               `bson:"flag"`
	FlagSetting flagsetting.FlagSetting `bson:"flag_setting"`
	CreatedBy   primitive.ObjectID      `bson:"created_by"`
	CreatedAt   time.Time               `bson:"created_at"`
	UpdatedAt   time.Time               `bson:"updated_at"`
}

FlagDetails contains the details of a particular flag in a particular environment.

type FlagProviderServer

type FlagProviderServer struct {
	providerpb.UnimplementedFlagProviderServer
	// contains filtered or unexported fields
}

FlagProviderServer is an implementation of the FlagProvider service.

func NewFlagProviderServer

func NewFlagProviderServer(
	providerRepo ProviderRepository,
	cacheRepo ProviderCacheRepository,
) *FlagProviderServer

func (*FlagProviderServer) GetFlag

type ProviderCacheRepository

type ProviderCacheRepository interface {
	// IsStatusCached checks if the flag status is already cached
	IsFlagStatusCached(
		ctx context.Context,
		params *cacheParameters,
	) (bool, error)

	// GetFlagStatus gets the currently cached value of the flag status.
	GetFlagStatus(ctx context.Context, params *cacheParameters) (bool, error)

	// CacheFlagStatus caches the value of the flag status.
	CacheFlagStatus(
		ctx context.Context,
		params *cacheParameters,
		status bool,
	) error
}

ProviderCacheRepository provides the interface for acessing the cache for storing flag statuses.

type ProviderRepository

type ProviderRepository interface {
	// GetFlagDetailsByProjectKey gets the details of a flag by the project key,
	// environment name and the flag name.
	GetFlagDetailsByProjectKey(
		ctx context.Context,
		projectKey string,
		environmentName string,
		flagName string,
	) ([]FlagDetails, error)
}

Jump to

Keyboard shortcuts

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