store: add Timeout option

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2022-07-08 22:16:33 +03:00
parent 9f7b61eb17
commit f4aee3414b

View File

@ -34,6 +34,8 @@ type Options struct {
Addrs []string
// Wrappers store wrapper that called before actual functions
// Wrappers []Wrapper
// Timeout specifies timeout duration for all operations
Timeout time.Duration
}
// NewOptions creates options struct
@ -110,6 +112,13 @@ func Tracer(t tracer.Tracer) Option {
}
}
// Timeout sets the timeout
func Timeout(td time.Duration) Option {
return func(o *Options) {
o.Timeout = td
}
}
// Addrs contains the addresses or other connection information of the backing storage.
// For example, an etcd implementation would contain the nodes of the cluster.
// A SQL implementation could contain one or more connection strings.