[#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).
|
||||
func (e *StorageEngine) ContainerSize(prm *ContainerSizePrm) (res *ContainerSizeRes) {
|
||||
err := e.exec(func() error {
|
||||
err := e.execIfNotBlocked(func() error {
|
||||
res = e.containerSize(prm)
|
||||
return nil
|
||||
})
|
||||
|
@ -92,7 +92,7 @@ func (e *StorageEngine) containerSize(prm *ContainerSizePrm) *ContainerSizeRes {
|
|||
//
|
||||
// Returns empty result if executions are blocked (see BlockExecution).
|
||||
func (e *StorageEngine) ListContainers(_ *ListContainersPrm) (res *ListContainersRes) {
|
||||
err := e.exec(func() error {
|
||||
err := e.execIfNotBlocked(func() error {
|
||||
res = e.listContainers()
|
||||
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.
|
||||
// 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 {
|
||||
return e.setBlockExecErr(errClosed)
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ func (e *StorageEngine) close() error {
|
|||
// executes op if execution is not blocked, otherwise returns blocking error.
|
||||
//
|
||||
// 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()
|
||||
defer e.blockExec.mtx.RUnlock()
|
||||
|
||||
|
@ -110,7 +110,7 @@ func (e *StorageEngine) setBlockExecErr(err error) error {
|
|||
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.
|
||||
//
|
||||
// С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).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -45,7 +45,7 @@ func (r *GetRes) Object() *object.Object {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -60,7 +60,7 @@ func (r *HeadRes) Header() *object.Object {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -52,7 +52,7 @@ var errInhumeFailure = errors.New("inhume operation failed")
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -36,7 +36,7 @@ func (p *PutPrm) WithObject(obj *object.Object) *PutPrm {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -63,7 +63,7 @@ func (r *RngRes) Object() *object.Object {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
|
@ -50,7 +50,7 @@ func (r *SelectRes) AddressList() []*object.Address {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
@ -111,7 +111,7 @@ func (e *StorageEngine) _select(prm *SelectPrm) (*SelectRes, error) {
|
|||
//
|
||||
// Returns an error if executions are blocked (see BlockExecution).
|
||||
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)
|
||||
return err
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue