Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Lance format Lance Java ReserveFragmentsOp

From Leeroopedia


Knowledge Sources
Domains Java_SDK, Dataset_Management
Last Updated 2026-02-08 19:33 GMT

Overview

Description

The ReserveFragments class is an immutable operation that reserves a specified number of fragment IDs for future use in a Lance dataset. It implements the Operation interface and carries a single integer field indicating how many fragment IDs to reserve.

This operation is used in coordination scenarios where fragment IDs must be pre-allocated before the actual data is written. By reserving IDs ahead of time, concurrent writers can avoid ID conflicts.

Usage

Use ReserveFragments in distributed or multi-writer scenarios where fragment IDs must be claimed before data writing begins. This ensures that separately produced fragments do not collide on their IDs when committed.

Code Reference

Source Location

java/src/main/java/org/lance/operation/ReserveFragments.java

Signature

public class ReserveFragments implements Operation {
    public static Builder builder();
    public int numFragments();
    public String name();  // returns "ReserveFragments"
}

Import

import org.lance.operation.ReserveFragments;

I/O Contract

Inputs
Parameter Type Required Description
numFragments int Yes The number of fragment IDs to reserve
Outputs
Return Type Description
numFragments() int The number of fragment IDs reserved
name() String Returns "ReserveFragments" for JNI dispatch

Usage Examples

// Reserve 10 fragment IDs for a distributed write operation
ReserveFragments reserveOp = ReserveFragments.builder()
    .numFragments(10)
    .build();

int reserved = reserveOp.numFragments(); // 10
String opName = reserveOp.name(); // "ReserveFragments"

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment