store: add Timeout option #139

Merged
vtolstov merged 3 commits from store into v3 2022-07-08 22:41:47 +03:00
Showing only changes of commit f4aee3414b - Show all commits

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.