From f4aee3414b9ac69932724759cd9002305f9253dd Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Fri, 8 Jul 2022 22:16:33 +0300 Subject: [PATCH] store: add Timeout option Signed-off-by: Vasiliy Tolstov --- store/options.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/store/options.go b/store/options.go index 3fa6c79d..f8360e41 100644 --- a/store/options.go +++ b/store/options.go @@ -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.