Skip to main content

Plugin Author Guide

This page is a guide for developers interested in creating, managing, and enhancing plugins for OpenBao.

Table of contents

List pagination

When implementing listing, it is recommended to use pagination so that items are processed in increments rather than loading the entire set into memory at once. Learn more in rfcs/paginated-lists. HandleListPage(...) is a helper introduced in PR #781 to streamline list pagination across implementations. It supports both item-level and batch-level callbacks for flexibility:

  • itemCallback(...): Processes individual entries within a page.

    • Parameters:
      • page (int): The index of the current page.
      • index (int): The index of the entry within the current page.
      • entry (*logical.StorageEntry): The current storage entry being processed.
    • Returns:
      • cont (bool): Whether to continue processing further entries.
      • err (error): An error, if encountered.
  • batchCallback(...): Executes after processing all entries in a page.

    • Parameters:
      • page (int): The index of the current page.
      • entries ([]*logical.StorageEntry): All entries in the current batch.
    • Returns:
      • cont (bool): Whether to continue processing further pages.
      • err (error): An error, if encountered.

The callbacks are executed sequentially, with itemCallback processing each entry individually, followed by batchCallback handling the entire batch.