forked from TrueCloudLab/frostfs-node
[#922] engine: Fix typos and improve naming related to exec blocks
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
6b1ce99c35
commit
a537334f33
9 changed files with 13 additions and 13 deletions
|
@ -40,7 +40,7 @@ func (r *ListContainersRes) Containers() []*cid.ID {
|
||||||
//
|
//
|
||||||
// Returns empty result if executions are blocked (see BlockExecution).
|
// Returns empty result if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) ContainerSize(prm *ContainerSizePrm) (res *ContainerSizeRes) {
|
func (e *StorageEngine) ContainerSize(prm *ContainerSizePrm) (res *ContainerSizeRes) {
|
||||||
err := e.exec(func() error {
|
err := e.execIfNotBlocked(func() error {
|
||||||
res = e.containerSize(prm)
|
res = e.containerSize(prm)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -92,7 +92,7 @@ func (e *StorageEngine) containerSize(prm *ContainerSizePrm) *ContainerSizeRes {
|
||||||
//
|
//
|
||||||
// Returns empty result if executions are blocked (see BlockExecution).
|
// Returns empty result if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) ListContainers(_ *ListContainersPrm) (res *ListContainersRes) {
|
func (e *StorageEngine) ListContainers(_ *ListContainersPrm) (res *ListContainersRes) {
|
||||||
err := e.exec(func() error {
|
err := e.execIfNotBlocked(func() error {
|
||||||
res = e.listContainers()
|
res = e.listContainers()
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
|
@ -44,7 +44,7 @@ var errClosed = errors.New("storage engine is closed")
|
||||||
// Close releases all StorageEngine's components. Waits for all data-related operations to complete.
|
// Close releases all StorageEngine's components. Waits for all data-related operations to complete.
|
||||||
// After the call, all the next ones will fail until the ResumeExecution call.
|
// After the call, all the next ones will fail until the ResumeExecution call.
|
||||||
//
|
//
|
||||||
// Еhe method is supposed to be called when the application exits.
|
// The method is supposed to be called when the application exits.
|
||||||
func (e *StorageEngine) Close() error {
|
func (e *StorageEngine) Close() error {
|
||||||
return e.setBlockExecErr(errClosed)
|
return e.setBlockExecErr(errClosed)
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ func (e *StorageEngine) close() error {
|
||||||
// executes op if execution is not blocked, otherwise returns blocking error.
|
// executes op if execution is not blocked, otherwise returns blocking error.
|
||||||
//
|
//
|
||||||
// Can be called concurrently with setBlockExecErr.
|
// Can be called concurrently with setBlockExecErr.
|
||||||
func (e *StorageEngine) exec(op func() error) error {
|
func (e *StorageEngine) execIfNotBlocked(op func() error) error {
|
||||||
e.blockExec.mtx.RLock()
|
e.blockExec.mtx.RLock()
|
||||||
defer e.blockExec.mtx.RUnlock()
|
defer e.blockExec.mtx.RUnlock()
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ func (e *StorageEngine) setBlockExecErr(err error) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// BlockExecution block blocks the execution of any data-related operation. All blocked ops will return err.
|
// BlockExecution blocks the execution of any data-related operation. All blocked ops will return err.
|
||||||
// To resume the execution, use ResumeExecution method.
|
// To resume the execution, use ResumeExecution method.
|
||||||
//
|
//
|
||||||
// Сan be called regardless of the fact of the previous blocking. If execution wasn't blocked, releases all resources
|
// Сan be called regardless of the fact of the previous blocking. If execution wasn't blocked, releases all resources
|
||||||
|
|
|
@ -29,7 +29,7 @@ func (p *DeletePrm) WithAddresses(addr ...*objectSDK.Address) *DeletePrm {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Delete(prm *DeletePrm) (res *DeleteRes, err error) {
|
func (e *StorageEngine) Delete(prm *DeletePrm) (res *DeleteRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.delete(prm)
|
res, err = e.delete(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -45,7 +45,7 @@ func (r *GetRes) Object() *object.Object {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Get(prm *GetPrm) (res *GetRes, err error) {
|
func (e *StorageEngine) Get(prm *GetPrm) (res *GetRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.get(prm)
|
res, err = e.get(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (r *HeadRes) Header() *object.Object {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Head(prm *HeadPrm) (res *HeadRes, err error) {
|
func (e *StorageEngine) Head(prm *HeadPrm) (res *HeadRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.head(prm)
|
res, err = e.head(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -52,7 +52,7 @@ var errInhumeFailure = errors.New("inhume operation failed")
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Inhume(prm *InhumePrm) (res *InhumeRes, err error) {
|
func (e *StorageEngine) Inhume(prm *InhumePrm) (res *InhumeRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.inhume(prm)
|
res, err = e.inhume(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -36,7 +36,7 @@ func (p *PutPrm) WithObject(obj *object.Object) *PutPrm {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Put(prm *PutPrm) (res *PutRes, err error) {
|
func (e *StorageEngine) Put(prm *PutPrm) (res *PutRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.put(prm)
|
res, err = e.put(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -63,7 +63,7 @@ func (r *RngRes) Object() *object.Object {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) GetRange(prm *RngPrm) (res *RngRes, err error) {
|
func (e *StorageEngine) GetRange(prm *RngPrm) (res *RngRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.getRange(prm)
|
res, err = e.getRange(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (r *SelectRes) AddressList() []*object.Address {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) Select(prm *SelectPrm) (res *SelectRes, err error) {
|
func (e *StorageEngine) Select(prm *SelectPrm) (res *SelectRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e._select(prm)
|
res, err = e._select(prm)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
@ -111,7 +111,7 @@ func (e *StorageEngine) _select(prm *SelectPrm) (*SelectRes, error) {
|
||||||
//
|
//
|
||||||
// Returns an error if executions are blocked (see BlockExecution).
|
// Returns an error if executions are blocked (see BlockExecution).
|
||||||
func (e *StorageEngine) List(limit uint64) (res *SelectRes, err error) {
|
func (e *StorageEngine) List(limit uint64) (res *SelectRes, err error) {
|
||||||
err = e.exec(func() error {
|
err = e.execIfNotBlocked(func() error {
|
||||||
res, err = e.list(limit)
|
res, err = e.list(limit)
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue