[#1548] engine: Rename parent -> ecParent
Parent could mean split parent or EC parent. In this case it is EC parent only. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
15139d80c9
commit
386a12eea4
4 changed files with 17 additions and 17 deletions
|
@ -42,7 +42,7 @@ func benchmarkExists(b *testing.B, shardNum int) {
|
|||
for range b.N {
|
||||
var shPrm shard.ExistsPrm
|
||||
shPrm.Address = addr
|
||||
shPrm.ParentAddress = oid.Address{}
|
||||
shPrm.ECParentAddress = oid.Address{}
|
||||
ok, _, err := e.exists(context.Background(), shPrm)
|
||||
if err != nil || ok {
|
||||
b.Fatalf("%t %v", ok, err)
|
||||
|
|
|
@ -71,21 +71,21 @@ func (e *StorageEngine) put(ctx context.Context, prm PutPrm) error {
|
|||
|
||||
// In #1146 this check was parallelized, however, it became
|
||||
// much slower on fast machines for 4 shards.
|
||||
var parent oid.Address
|
||||
var ecParent oid.Address
|
||||
if prm.Object.ECHeader() != nil {
|
||||
parent.SetObject(prm.Object.ECHeader().Parent())
|
||||
parent.SetContainer(addr.Container())
|
||||
ecParent.SetObject(prm.Object.ECHeader().Parent())
|
||||
ecParent.SetContainer(addr.Container())
|
||||
}
|
||||
var shPrm shard.ExistsPrm
|
||||
shPrm.Address = addr
|
||||
shPrm.ParentAddress = parent
|
||||
shPrm.ECParentAddress = ecParent
|
||||
existed, locked, err := e.exists(ctx, shPrm)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !existed && locked {
|
||||
lockers, err := e.GetLocked(ctx, parent)
|
||||
lockers, err := e.GetLocked(ctx, ecParent)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import (
|
|||
// ExistsPrm groups the parameters of Exists operation.
|
||||
type ExistsPrm struct {
|
||||
addr oid.Address
|
||||
paddr oid.Address
|
||||
ecParentAddr oid.Address
|
||||
}
|
||||
|
||||
// ExistsRes groups the resulting values of Exists operation.
|
||||
|
@ -37,9 +37,9 @@ func (p *ExistsPrm) SetAddress(addr oid.Address) {
|
|||
p.addr = addr
|
||||
}
|
||||
|
||||
// SetParent is an Exists option to set objects parent.
|
||||
func (p *ExistsPrm) SetParent(addr oid.Address) {
|
||||
p.paddr = addr
|
||||
// SetECParent is an Exists option to set objects parent.
|
||||
func (p *ExistsPrm) SetECParent(addr oid.Address) {
|
||||
p.ecParentAddr = addr
|
||||
}
|
||||
|
||||
// Exists returns the fact that the object is in the metabase.
|
||||
|
@ -82,7 +82,7 @@ func (db *DB) Exists(ctx context.Context, prm ExistsPrm) (res ExistsRes, err err
|
|||
currEpoch := db.epochState.CurrentEpoch()
|
||||
|
||||
err = db.boltDB.View(func(tx *bbolt.Tx) error {
|
||||
res.exists, res.locked, err = db.exists(tx, prm.addr, prm.paddr, currEpoch)
|
||||
res.exists, res.locked, err = db.exists(tx, prm.addr, prm.ecParentAddr, currEpoch)
|
||||
|
||||
return err
|
||||
})
|
||||
|
@ -90,10 +90,10 @@ func (db *DB) Exists(ctx context.Context, prm ExistsPrm) (res ExistsRes, err err
|
|||
return res, metaerr.Wrap(err)
|
||||
}
|
||||
|
||||
func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, parent oid.Address, currEpoch uint64) (bool, bool, error) {
|
||||
func (db *DB) exists(tx *bbolt.Tx, addr oid.Address, ecParent oid.Address, currEpoch uint64) (bool, bool, error) {
|
||||
var locked bool
|
||||
if !parent.Equals(oid.Address{}) {
|
||||
locked = objectLocked(tx, parent.Container(), parent.Object())
|
||||
if !ecParent.Equals(oid.Address{}) {
|
||||
locked = objectLocked(tx, ecParent.Container(), ecParent.Object())
|
||||
}
|
||||
// check graveyard and object expiration first
|
||||
st, err := objectStatus(tx, addr, currEpoch)
|
||||
|
|
|
@ -18,7 +18,7 @@ type ExistsPrm struct {
|
|||
// Exists option to set object checked for existence.
|
||||
Address oid.Address
|
||||
// Exists option to set parent object checked for existence.
|
||||
ParentAddress oid.Address
|
||||
ECParentAddress oid.Address
|
||||
}
|
||||
|
||||
// ExistsRes groups the resulting values of Exists operation.
|
||||
|
@ -74,7 +74,7 @@ func (s *Shard) Exists(ctx context.Context, prm ExistsPrm) (ExistsRes, error) {
|
|||
} else {
|
||||
var existsPrm meta.ExistsPrm
|
||||
existsPrm.SetAddress(prm.Address)
|
||||
existsPrm.SetParent(prm.ParentAddress)
|
||||
existsPrm.SetECParent(prm.ECParentAddress)
|
||||
|
||||
var res meta.ExistsRes
|
||||
res, err = s.metaBase.Exists(ctx, existsPrm)
|
||||
|
|
Loading…
Reference in a new issue