Skip to content

Commit

Permalink
Merge 0bcc25c into 0af3fde
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Lenčo committed Aug 9, 2019
2 parents 0af3fde + 0bcc25c commit 8d48e70
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion db/keyval/etcd/plugin_impl_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ type Deps struct {
infra.PluginDeps
StatusCheck statuscheck.PluginStatusWriter // inject
Resync *resync.Plugin
Serializer keyval.Serializer // optional, by default the JSON serializer is used
}

// Init retrieves ETCD configuration and establishes a new connection
Expand Down Expand Up @@ -139,6 +140,11 @@ func (p *Plugin) NewWatcher(keyPrefix string) keyval.ProtoWatcher {
return p.protoWrapper.NewWatcher(keyPrefix)
}

// RawAccess allows to access data in the database as raw bytes (i.e. not formatted by protobuf).
func (p *Plugin) RawAccess() keyval.KvBytesPlugin {
return p.connection
}

// Disabled returns *true* if the plugin is not in use due to missing
// etcd configuration.
func (p *Plugin) Disabled() (disabled bool) {
Expand Down Expand Up @@ -247,7 +253,13 @@ func (p *Plugin) configureConnection() {
}
p.startPeriodicAutoCompact(p.config.AutoCompact)
}
p.protoWrapper = kvproto.NewProtoWrapper(p.connection, &keyval.SerializerJSON{})
var serializer keyval.Serializer
if p.Serializer != nil {
serializer = p.Serializer
} else {
serializer = &keyval.SerializerJSON{}
}
p.protoWrapper = kvproto.NewProtoWrapper(p.connection, serializer)
}

// ETCD status check probe function
Expand Down

0 comments on commit 8d48e70

Please sign in to comment.