[#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
47f12f8440
commit
6ea8f2b23c
4 changed files with 17 additions and 17 deletions
|
@ -42,7 +42,7 @@ func benchmarkExists(b *testing.B, shardNum int) {
|
||||||
for range b.N {
|
for range b.N {
|
||||||
var shPrm shard.ExistsPrm
|
var shPrm shard.ExistsPrm
|
||||||
shPrm.Address = addr
|
shPrm.Address = addr
|
||||||
shPrm.ParentAddress = oid.Address{}
|
shPrm.ECParentAddress = oid.Address{}
|
||||||
ok, _, err := e.exists(context.Background(), shPrm)
|
ok, _, err := e.exists(context.Background(), shPrm)
|
||||||
if err != nil || ok {
|
if err != nil || ok {
|
||||||
b.Fatalf("%t %v", ok, err)
|
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
|
// In #1146 this check was parallelized, however, it became
|
||||||
// much slower on fast machines for 4 shards.
|
// much slower on fast machines for 4 shards.
|
||||||
var parent oid.Address
|
var ecParent oid.Address
|
||||||
if prm.Object.ECHeader() != nil {
|
if prm.Object.ECHeader() != nil {
|
||||||
parent.SetObject(prm.Object.ECHeader().Parent())
|
ecParent.SetObject(prm.Object.ECHeader().Parent())
|
||||||
parent.SetContainer(addr.Container())
|
ecParent.SetContainer(addr.Container())
|
||||||
}
|
}
|
||||||
var shPrm shard.ExistsPrm
|
var shPrm shard.ExistsPrm
|
||||||
shPrm.Address = addr
|
shPrm.Address = addr
|
||||||
shPrm.ParentAddress = parent
|
shPrm.ECParentAddress = ecParent
|
||||||
existed, locked, err := e.exists(ctx, shPrm)
|
existed, locked, err := e.exists(ctx, shPrm)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !existed && locked {
|
if !existed && locked {
|
||||||
lockers, err := e.GetLocked(ctx, parent)
|
lockers, err := e.GetLocked(ctx, ecParent)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,8 @@ import (
|
||||||
|
|
||||||
// ExistsPrm groups the parameters of Exists operation.
|
// ExistsPrm groups the parameters of Exists operation.
|
||||||
type ExistsPrm struct {
|
type ExistsPrm struct {
|
||||||
addr oid.Address
|
addr oid.Address
|
||||||
paddr oid.Address
|
ecParentAddr oid.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExistsRes groups the resulting values of Exists operation.
|
// ExistsRes groups the resulting values of Exists operation.
|
||||||
|
@ -37,9 +37,9 @@ func (p *ExistsPrm) SetAddress(addr oid.Address) {
|
||||||
p.addr = addr
|
p.addr = addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetParent is an Exists option to set objects parent.
|
// SetECParent is an Exists option to set objects parent.
|
||||||
func (p *ExistsPrm) SetParent(addr oid.Address) {
|
func (p *ExistsPrm) SetECParent(addr oid.Address) {
|
||||||
p.paddr = addr
|
p.ecParentAddr = addr
|
||||||
}
|
}
|
||||||
|
|
||||||
// Exists returns the fact that the object is in the metabase.
|
// 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()
|
currEpoch := db.epochState.CurrentEpoch()
|
||||||
|
|
||||||
err = db.boltDB.View(func(tx *bbolt.Tx) error {
|
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
|
return err
|
||||||
})
|
})
|
||||||
|
@ -90,10 +90,10 @@ func (db *DB) Exists(ctx context.Context, prm ExistsPrm) (res ExistsRes, err err
|
||||||
return res, metaerr.Wrap(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
|
var locked bool
|
||||||
if !parent.Equals(oid.Address{}) {
|
if !ecParent.Equals(oid.Address{}) {
|
||||||
locked = objectLocked(tx, parent.Container(), parent.Object())
|
locked = objectLocked(tx, ecParent.Container(), ecParent.Object())
|
||||||
}
|
}
|
||||||
// check graveyard and object expiration first
|
// check graveyard and object expiration first
|
||||||
st, err := objectStatus(tx, addr, currEpoch)
|
st, err := objectStatus(tx, addr, currEpoch)
|
||||||
|
|
|
@ -18,7 +18,7 @@ type ExistsPrm struct {
|
||||||
// Exists option to set object checked for existence.
|
// Exists option to set object checked for existence.
|
||||||
Address oid.Address
|
Address oid.Address
|
||||||
// Exists option to set parent object checked for existence.
|
// Exists option to set parent object checked for existence.
|
||||||
ParentAddress oid.Address
|
ECParentAddress oid.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
// ExistsRes groups the resulting values of Exists operation.
|
// ExistsRes groups the resulting values of Exists operation.
|
||||||
|
@ -74,7 +74,7 @@ func (s *Shard) Exists(ctx context.Context, prm ExistsPrm) (ExistsRes, error) {
|
||||||
} else {
|
} else {
|
||||||
var existsPrm meta.ExistsPrm
|
var existsPrm meta.ExistsPrm
|
||||||
existsPrm.SetAddress(prm.Address)
|
existsPrm.SetAddress(prm.Address)
|
||||||
existsPrm.SetParent(prm.ParentAddress)
|
existsPrm.SetECParent(prm.ECParentAddress)
|
||||||
|
|
||||||
var res meta.ExistsRes
|
var res meta.ExistsRes
|
||||||
res, err = s.metaBase.Exists(ctx, existsPrm)
|
res, err = s.metaBase.Exists(ctx, existsPrm)
|
||||||
|
|
Loading…
Reference in a new issue