Documentation
¶
Overview ¶
Package google implements a ConfigPersister making use of Google Cloud's Datastore to store configuration. See https://cloud.google.com/datastore/ for more details.
Configuration ------------- This package expects a Google Cloud account set up, and should be initialized with a JSON file containing credentials with which to connect to Google Cloud. Google Cloud Datastore should be enabled on your account. A JSON credentials file can be created by browsing to https://console.cloud.google.com/iam-admin/serviceaccounts and selecting your project, and creating a new key.
The Datastore should further be configured with a namespace and an entity type, both of which should be passed in to the `New()` function when creating a new DatastoreConfigPersister. Do not create any entity instances by hand; they should only ever be created by this package.
Once configurations are persisted, they can be viewed on the Google Cloud admin dashboard.
Index ¶
- type DatastoreConfigPersister
- func (p *DatastoreConfigPersister) Close()
- func (p *DatastoreConfigPersister) ConfigChangedWatcher() <-chan struct{}
- func (p *DatastoreConfigPersister) PersistAndNotify(oldHash string, cfg *pb.ServiceConfig) error
- func (p *DatastoreConfigPersister) ReadHistoricalConfigs() ([]*pb.ServiceConfig, error)
- func (p *DatastoreConfigPersister) ReadPersistedConfig() (*pb.ServiceConfig, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatastoreConfigPersister ¶
type DatastoreConfigPersister struct { *internal.Notifier // contains filtered or unexported fields }
DatastoreConfigPersister is a config persister that makes use of Google Cloud's Datastore service.
func New ¶
func New(projectId, credentialsFile, namespace, entity string, pollingDuration time.Duration) (*DatastoreConfigPersister, error)
func (*DatastoreConfigPersister) Close ¶
func (p *DatastoreConfigPersister) Close()
Close closes the notification channel.
func (*DatastoreConfigPersister) ConfigChangedWatcher ¶
func (p *DatastoreConfigPersister) ConfigChangedWatcher() <-chan struct{}
func (*DatastoreConfigPersister) PersistAndNotify ¶
func (p *DatastoreConfigPersister) PersistAndNotify(oldHash string, cfg *pb.ServiceConfig) error
func (*DatastoreConfigPersister) ReadHistoricalConfigs ¶
func (p *DatastoreConfigPersister) ReadHistoricalConfigs() ([]*pb.ServiceConfig, error)
func (*DatastoreConfigPersister) ReadPersistedConfig ¶
func (p *DatastoreConfigPersister) ReadPersistedConfig() (*pb.ServiceConfig, error)