Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Changelog for NeoFS Node
- Unpaid container's data is deleted now (#3691)
- Policer iterates engine-level object list now instead of shard-level (#3862)
- SN now ignores `copies_number` field of `object.PutRequest.Body.Init` message (#3830)
- Policer starts from a random offset (#3879)

### Removed
- `node.persistent_sessions.path` config option from SN config (#3846)
Expand Down
10 changes: 10 additions & 0 deletions pkg/local_object_storage/engine/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ func NewCursor(cnr cid.ID, obj oid.ID) *Cursor {
return &Cursor{shardCursor: shard.NewCursor(cnr, obj)}
}

// ContainerID returns the container ID stored in the cursor.
func (c *Cursor) ContainerID() cid.ID {
return c.shardCursor.ContainerID()
}

// ObjectID returns the object ID stored in the cursor.
func (c *Cursor) ObjectID() oid.ID {
return c.shardCursor.LastObjectID()
}

// ListWithCursor lists physical objects available in the engine starting
// from the cursor. It includes regular, tombstone and storage group objects.
// Does not include inhumed objects. Use cursor value from the response
Expand Down
16 changes: 11 additions & 5 deletions pkg/services/policer/policer.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,21 @@ func (oiw *objectsInWork) inWork(addr oid.Address) bool {
return ok
}

func (oiw *objectsInWork) remove(addr oid.Address) {
func (oiw *objectsInWork) tryAdd(addr oid.Address) bool {
oiw.m.Lock()
delete(oiw.objs, addr)
oiw.m.Unlock()
defer oiw.m.Unlock()

if _, ok := oiw.objs[addr]; ok {
return false
}

oiw.objs[addr] = struct{}{}
return true
}

func (oiw *objectsInWork) add(addr oid.Address) {
func (oiw *objectsInWork) remove(addr oid.Address) {
oiw.m.Lock()
oiw.objs[addr] = struct{}{}
delete(oiw.objs, addr)
oiw.m.Unlock()
}

Expand Down
Loading
Loading