go-server-sdk: github.com/launchdarkly/go-server-sdk/internal Index | Files

package internal

import "github.com/launchdarkly/go-server-sdk/internal"

Package internal contains SDK implementation details that are shared between packages, but are not exposed to application code.

Index

Package Files

feature_store_status.go internal.go

type FeatureStoreStatus Uses

type FeatureStoreStatus struct {
    // True if the store is currently usable. For a persistent store, this will be false if the last
    // database operation failed and we have not yet seen evidence that the database is working.
    Available bool
    // True if the store may be out of date due to a previous outage, so the SDK should attempt to
    // refresh all feature flag data and rewrite it to the store.
    NeedsRefresh bool
}

FeatureStoreStatus is a description of whether a feature store is functioning normally.

type FeatureStoreStatusManager Uses

type FeatureStoreStatusManager struct {
    // contains filtered or unexported fields
}

FeatureStoreStatusManager manages status subscriptions and can poll for recovery.

func NewFeatureStoreStatusManager Uses

func NewFeatureStoreStatusManager(availableNow bool, pollFn func() bool, refreshOnRecovery bool,
    loggers ldlog.Loggers) *FeatureStoreStatusManager

NewFeatureStoreStatusManager creates a new FeatureStoreStatusManager. The pollFn should return true if the store is available, false if not.

func (*FeatureStoreStatusManager) Close Uses

func (m *FeatureStoreStatusManager) Close()

Close shuts down all channels and goroutines used by the manager.

func (*FeatureStoreStatusManager) IsAvailable Uses

func (m *FeatureStoreStatusManager) IsAvailable() bool

IsAvailable tests whether the last known status was available.

func (*FeatureStoreStatusManager) Subscribe Uses

func (m *FeatureStoreStatusManager) Subscribe() FeatureStoreStatusSubscription

Subscribe opens a channel for status updates.

func (*FeatureStoreStatusManager) UpdateAvailability Uses

func (m *FeatureStoreStatusManager) UpdateAvailability(available bool)

UpdateAvailability signals that the store is now available or unavailable. If that is a change, an update will be sent (and, if the new status is unavailable, it will start polling for recovery).

type FeatureStoreStatusProvider Uses

type FeatureStoreStatusProvider interface {
    // GetStoreStatus returns the current status of the store.
    GetStoreStatus() FeatureStoreStatus
    // StatusSubscribe creates a channel that will receive all changes in store status.
    StatusSubscribe() FeatureStoreStatusSubscription
}

FeatureStoreStatusProvider is an optional interface that can be implemented by a FeatureStore. It allows other SDK components to detect whether the store is in a usable state.

type FeatureStoreStatusSubscription Uses

type FeatureStoreStatusSubscription interface {
    // The channel for receiving updates.
    Channel() <-chan FeatureStoreStatus
    // Stops the subscription, closing the channel.
    Close()
}

FeatureStoreStatusSubscription represents a subscription to feature store status updates.

Package internal imports 3 packages (graph). Updated 2020-03-17. Refresh now. Tools for package owners.