Skip to content

Getting a list of objects

To retrieve a list of objects, the SEARCH method is used, which returns a reader that allows data to be loaded from the server in chunks. Each call to the .read() method, which can fit into a 4MB gRPC package, returns a list of up to 43,690 objects (or fewer if the remaining objects do not fill a complete package).

The method used to obtain the list of objects returns a Reader. This allows iterating through the results and gradually loading data from the server without the need for pagination or limitations on the total number of objects.

To limit the response dataset, filters can be applied before executing the request.

Arguments:

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

Result:

  • List of objects IDs
1
2
3
4
5
6
func Search(ctx context.Context, p pool.Pool, cnrID cid.ID) (ResObjectSearch, error) {
    var prmSearch pool.PrmObjectSearch
    prmSearch.SetContainerID(cnrID)

    return p.SearchObjects(ctx, prmSearch)
}
1
2
3
4
public static void search(FrostFSClient frostFSClient, ContainerId containerId, CallContext callContext, ObjectFilter[] filters) {
    var prmObjectSearch = new PrmObjectSearch(containerId, filters);
    var objects = frostFSClient.searchObjects(prmObjectSearch, callContext);
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
public static IAsyncEnumerable<FrostFsObjectId> Search(
    IFrostFSClient client,
    FrostFsContainerId containerId,
    IObjectFilter filter)
{
    PrmObjectSearch searchParam = new(
        containerId: containerId,
        token: null,
        xheaders: [],
        filters: filter);

    return client.SearchObjectsAsync(searchParam, default);
}