...

Source file src/github.com/launchdarkly/go-server-sdk/v6/internal/datastore/data_store_status_provider_impl.go

Documentation: github.com/launchdarkly/go-server-sdk/v6/internal/datastore

     1  package datastore
     2  
     3  import (
     4  	"github.com/launchdarkly/go-server-sdk/v6/interfaces"
     5  	"github.com/launchdarkly/go-server-sdk/v6/subsystems"
     6  )
     7  
     8  // dataStoreStatusProviderImpl is the internal implementation of DataStoreStatusProvider. It's not
     9  // exported because the rest of the SDK code only interacts with the public interface.
    10  type dataStoreStatusProviderImpl struct {
    11  	store            subsystems.DataStore
    12  	dataStoreUpdates *DataStoreUpdateSinkImpl
    13  }
    14  
    15  // NewDataStoreStatusProviderImpl creates the internal implementation of DataStoreStatusProvider.
    16  func NewDataStoreStatusProviderImpl(
    17  	store subsystems.DataStore,
    18  	dataStoreUpdates *DataStoreUpdateSinkImpl,
    19  ) interfaces.DataStoreStatusProvider {
    20  	return &dataStoreStatusProviderImpl{
    21  		store:            store,
    22  		dataStoreUpdates: dataStoreUpdates,
    23  	}
    24  }
    25  
    26  func (d *dataStoreStatusProviderImpl) GetStatus() interfaces.DataStoreStatus {
    27  	return d.dataStoreUpdates.getStatus()
    28  }
    29  
    30  func (d *dataStoreStatusProviderImpl) IsStatusMonitoringEnabled() bool {
    31  	return d.store.IsStatusMonitoringEnabled()
    32  }
    33  
    34  func (d *dataStoreStatusProviderImpl) AddStatusListener() <-chan interfaces.DataStoreStatus {
    35  	return d.dataStoreUpdates.getBroadcaster().AddListener()
    36  }
    37  
    38  func (d *dataStoreStatusProviderImpl) RemoveStatusListener(ch <-chan interfaces.DataStoreStatus) {
    39  	d.dataStoreUpdates.getBroadcaster().RemoveListener(ch)
    40  }
    41  

View as plain text