Skip to content

Deleting Objects

To delete an object, you need to know its ID and the ID of the container where it is stored. As a result of the deletion, a new object with a unique identifier and type tombstone will be created, containing meta-information about the deleted object.

Arguments:

  1. Execution context
  2. Method arguments, which includes:
    • Container ID
    • Object ID
    • Additional headers (optional)

Result:

  • Success, if there are no errors
1
2
3
4
5
6
7
func DeleteObject(ctx context.Context, p pool.Pool, addr oid.Address) error {
    var prm pool.PrmObjectDelete
    prm.SetAddress(addr)

    err := p.DeleteObject(ctx, prm)
    return err
}
1
2
3
4
5
public static void deleteObject(FrostFSClient frostFSClient, ContainerId containerId, ObjectId objectId,
                           CallContext callContext) {
    var prmObjectDelete = new PrmObjectDelete(containerId, objectId);
    frostFSClient.deleteObject(prmObjectDelete, callContext);
}
1
2
3
4
5
6
7
8
9
public static async Task DeleteObjectAsync(
    FrostFSClient client, 
    FrostFsContainerId containerId, 
    FrostFsObjectId objectId)
{
    var args = new PrmObjectDelete(containerId, objectId);

    await client.DeleteObjectAsync(args, default);
}