[#180] pool: add WaitForContainerRemoved
Signed-off-by: Denis Kirillov <denis@nspcc.ru>
This commit is contained in:
parent
47345a33da
commit
0dbea5452a
1 changed files with 13 additions and 0 deletions
13
pool/pool.go
13
pool/pool.go
|
@ -1540,6 +1540,19 @@ func WaitForEACLPresence(ctx context.Context, pool *Pool, cnrID *cid.ID, table *
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WaitForContainerRemoved waits until the container is removed from the NeoFS network.
|
||||||
|
func WaitForContainerRemoved(ctx context.Context, pool *Pool, cnrID *cid.ID, waitParams *WaitParams) error {
|
||||||
|
var prm PrmContainerGet
|
||||||
|
if cnrID != nil {
|
||||||
|
prm.SetContainerID(*cnrID)
|
||||||
|
}
|
||||||
|
|
||||||
|
return waitFor(ctx, waitParams, func(ctx context.Context) bool {
|
||||||
|
_, err := pool.GetContainer(ctx, prm)
|
||||||
|
return sdkClient.IsErrContainerNotFound(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
// waitFor await that given condition will be met in waitParams time.
|
// waitFor await that given condition will be met in waitParams time.
|
||||||
func waitFor(ctx context.Context, params *WaitParams, condition func(context.Context) bool) error {
|
func waitFor(ctx context.Context, params *WaitParams, condition func(context.Context) bool) error {
|
||||||
wctx, cancel := context.WithTimeout(ctx, params.timeout)
|
wctx, cancel := context.WithTimeout(ctx, params.timeout)
|
||||||
|
|
Loading…
Reference in a new issue