FLAM5 Segment Store

The Segment Store data format is the foundation for storing FLAM5 archives. It is designed to efficiently manage and store archived data in a flexible and scalable manner. All archived data is divided into segments, which are managed through versioned indices. This approach ensures that data can be easily accessed, modified, and maintained over time.

The Segment Store supports two distinct storage formats to cater to different storage needs and environments:

File Format
This format is intended for storing the entire archive in a single, sequential file. It is ideal for scenarios where a consolidated file is preferred for ease of management and transfer.
Object Format
This format is designed for storing the archive in multiple smaller objects. These objects can be stored locally in a folder-based structure or in cloud-based storage. The object format provides greater flexibility and scalability, especially for cloud storage solutions.

In the Segment Store, all data is stored in segments. These segments are managed via versioned indices, allowing for efficient tracking and retrieval of data across different versions. Each version of the archive maintains its own index, which lists all the segments and their respective metadata. When segments are deleted, they remain accessible through older versions until all older versions referencing them are deleted. This versioning system ensures that changes to the data can be tracked over time, and previous versions can be accessed as needed.

The Segment Store is particularly useful for applications that require robust data archiving and version control. Its ability to manage data in segments and support multiple storage formats makes it a versatile solution for both local and cloud-based storage environments.

The following sections describe both Segment Store formats.

File Format

Segment Store File Format

The segment store file format is designed to manage and store data efficiently across multiple versions. Each file contains one or more versions of data, with the data organized into blocks called segments. These segments are managed through versioned indices, allowing for multiple versions to be stored within a single file. This structure enables segments to be added or deleted between versions, providing flexibility in data management. Importantly, even if segments are deleted in newer versions, they can still be accessed through older versions until all versions referencing those segments are deleted.

Each version of the data has its own index, which contains a list of items describing the segments. These items include details such as the length of the segment, a delete flag, and the offset of the segment within the file. The index itself is structured with specific metadata: magic bytes to identify the file format, CRC32 checksums for integrity verification, a unique ID, creation date, segment count, and the offset of the index of the previous version. Additionally, the index includes the main segment ID, which helps in identifying the primary segment for that version.

The file header is a crucial part of the segment store file format. It includes magic bytes to identify the file format, the file format version, and the file offset of the latest segment index. This header ensures that the file can be correctly interpreted and accessed. The index items within each version's index provide detailed information about each segment, including the data length, flags (currently only a delete flag), and the start offset of the segment data within the file. This detailed indexing allows for efficient data retrieval and management across different versions.

File Format - Binary Layout

The following tables describe the exact on-disk layout of the flat file format. All multi-byte integer fields are stored in big-endian (network) byte order. The file format version is currently 1.

File Header (16 bytes)

Located at byte offset 0 of the file. Identifies the file as a FLAM5 segment store and provides the entry point into the version chain.

 Offset  Size  Type   Field          Description
 ------  ----  -----  -------------  ------------------------------------
      0     4  U08[4] magic          Magic bytes: "FLFF"
                                     (0x46 0x4C 0x46 0x46)
      4     2  U16    version        File format version; currently 1
      6     2  U16    padding        Reserved; must be 0
      8     8  U64    indexOffset    Byte offset of the latest index
                                     header within this file; 0 if no
                                     index has been written yet
Index Header (48 bytes)

Each version of the archive has its own index header. The most recent index is found at the offset given by the file header. Older versions are reached by following the prevIndexOffset chain backwards.

 Offset  Size  Type   Field            Description
 ------  ----  -----  ---------------  ----------------------------------
      0     4  U08[4] magic            Magic bytes: "FIDX"
                                       (0x46 0x49 0x44 0x58)
      4     4  U08[4] headerCrc32      CRC32 over bytes 8 through 47 of
                                       this header (itemsCrc32 through
                                       mainSegmentId); stored raw (not
                                       byte-swapped)
      8     4  U08[4] itemsCrc32       CRC32 over the compressed segment
                                       item data that immediately follows
                                       this header; stored raw
     12     4  U32    id               Monotonically increasing version
                                       ID; incremented with every new
                                       write transaction
     16     8  U64    date             Creation timestamp: seconds since
                                       the Unix epoch (UTC)
     24     8  U64    count            Number of segment index items
                                       stored in the compressed block
                                       that follows this header
     32     8  U64    prevIndexOffset  Byte offset of the previous
                                       version's index header; 0 if this
                                       is the oldest (first) version
     40     8  U64    mainSegmentId    Logical segment index of the
                                       archive root segment (the FL5DIR/
                                       FL5FMT/FL5LIT container)

The count field is bounded when the header is read: a value that would describe more than SEGSTORE_BUF_MAX (1042590744 bytes) worth of index items is rejected as corruption before any buffer is sized from it. The alternative check, comparing the item bytes against the file size, does not apply while index compression is active, because the bytes stored on disk are compressed.

Segment Index Items (16 bytes each)

The segment index items are stored ZSTD-compressed in one or more frames directly after the index header. Each uncompressed frame covers at most ZSTD_FRAME_SIZE = 262144 bytes (4096 << 6) of raw item data, compression level 3. The itemsCrc32 field covers the entire compressed byte sequence.

After decompression, count items of 16 bytes each are available:

 Offset  Size  Type  Field       Description
 ------  ----  ----  ----------  ----------------------------------------
      0     4  U32   length      Length of the segment payload in bytes
      4     4  U32   flags       Bit 0: delete flag (1 = segment deleted,
                                 0 = segment is valid). All other bits
                                 are reserved and must be 0.
      8     8  U64   fileOffset  Absolute byte offset of the segment
                                 payload within the flat file
Access Algorithm

To read a specific segment from the flat file:

1. Read 16 bytes from offset 0; verify magic is "FLFF"; byte-swap version, padding, and indexOffset from big-endian. 2. If indexOffset == 0 the archive is empty; otherwise seek to indexOffset and read 48 bytes; verify magic is "FIDX". 3. Verify headerCrc32 over bytes 8-47 of the index header. 4. Read the compressed item block (follows immediately after the index header); verify itemsCrc32 over this block. 5. Decompress using ZSTD in chunks of ZSTD_FRAME_SIZE = 262144 bytes (uncompressed) to obtain count * 16 bytes of raw item data. 6. The archive root segment is at logical index mainSegmentId. Check that items[mainSegmentId].flags bit 0 is clear (not deleted). 7. Seek to items[mainSegmentId].fileOffset; read items[mainSegmentId].length bytes -- this is the raw FL5 segment payload as described in the segment format appendix. 8. To access an older version: follow prevIndexOffset back through the chain (stop when prevIndexOffset == 0).

Tamper Detection

The implementation rejects a file if it finds an older index header with a byte offset that is greater than or equal to the offset of the index header that referenced it (prevIndexOffset >= currentOffset). This ordering constraint prevents offset-manipulation attacks.

Object Format

Segment Store Object Format

The segment store object format is a versatile and efficient method for managing storage of versioned archives as multiple data objects. It utilizes an abstract storage backend, allowing data objects to be stored either as a folder structure or remotely in the cloud. This flexibility ensures that the format can adapt to various storage needs and environments. The format is designed to store one or more versions of data, with segments managed in versioned indices.

The format defines three types of objects: root objects, index objects, and segment container objects. The root object serves as the entry point, containing pointers to all versioned indices. It includes essential metadata such as magic bytes, format version, CRC32, the number of index pointers, and a list of index pointers. Each index pointer has an ID, delete flag, creation date, and the highest object ID in use. This structure ensures efficient navigation and management of different data versions.

Index objects represent individual versions of data and contain a list of all data segments along with a pointer to the segment container object that stores the segment data. Each index object includes magic bytes, CRC32, segment count, main segment ID, and a list of segments. Each segment entry specifies its length, delete flag, object ID of the segment container, and offset within the container object.

Segment container objects are concatenations of one or more segments, referenced by the index objects. By aggregating multiple segments into segment containers, the format reduces access time, especially when using cloud storage. This design optimizes performance and ensures that data can be accessed quickly and efficiently, regardless of the storage backend.

The format diagram above illustrates the overall structure and relationships between these objects, providing a clear visual representation of the object storage format.

Object Format - Binary Layout

The following tables describe the exact binary layout of the object format. All multi-byte integer fields are stored in big-endian (network) byte order. The format version is currently 1.

Three object name prefixes are used within the configured namespace:

 Object name          Content
 -------------------  -------------------------------------------------
 root                 Single root object; entry point for every access
 index.<id>           Index object for version with decimal ID <id>
 object.<s2>.<s1>.<id> Segment container object; <s2>, <s1> are
                       hierarchical grouping keys derived from <id>
                       (see Object Naming below)
Root Object

The root object is always stored under the fixed name "root". It holds an array of version pointers, one per stored version of the archive.

Root Object Header (16 bytes):

 Offset  Size  Type   Field    Description
 ------  ----  -----  -------  -----------------------------------------
      0     4  U08[4] magic    Magic bytes: "FLOM" (0x46 0x4C 0x4F 0x4D)
      4     2  U16    version  Format version; currently 1
      6     2  U16    padding  Reserved; must be 0
      8     4  U08[4] crc32    CRC32 over bytes 12 through end of the
                               entire root object (count + all pointers);
                               stored raw (not byte-swapped)
     12     4  U32    count    Number of version pointer entries

Version Pointer Entry (24 bytes each, immediately follows header):

 Offset  Size  Type  Field          Description
 ------  ----  ----  -------------  -------------------------------------
      0     4  U32   id             Monotonically increasing version ID
      4     4  U32   flags          Bit 0: delete flag (1 = version
                                    deleted, 0 = version is valid)
      8     8  U64   date           Creation timestamp: seconds since
                                    the Unix epoch (UTC)
     16     8  U64   latestObjectId Highest container object ID ever
                                    assigned in this version; used to
                                    determine which container objects
                                    can safely be deleted during prune

The version pointers are ordered chronologically; the entry with the highest index is always the latest (most recent) version.

Index Object

One index object exists per archive version. Its name is constructed as "index.<id>" where <id> is the decimal representation of the version ID (e.g., "index.1", "index.42").

Index Object Header (24 bytes):

 Offset  Size  Type   Field         Description
 ------  ----  -----  ------------  ------------------------------------
      0     4  U08[4] magic         Magic bytes: "FIDX"
                                    (0x46 0x49 0x44 0x58)
      4     4  U08[4] crc32         CRC32 over the count and
                                    mainSegmentId fields (bytes 8-23)
                                    plus all decompressed segment index
                                    items; stored raw (not byte-swapped)
      8     8  U64    count         Number of segment index items
     16     8  U64    mainSegmentId Logical segment index of the archive
                                    root segment

The count field is bounded when the header is read, exactly as in the flat file format: a value that would describe more than SEGSTORE_BUF_MAX (1042590744 bytes) worth of index items is rejected as corruption before any buffer is sized from it.

The segment index items are stored ZSTD-compressed in one or more frames directly after the 24-byte header. The compression parameters are identical to the flat file format: ZSTD_FRAME_SIZE = 262144 bytes per frame (uncompressed), compression level 3.

After decompression, count items of 24 bytes each are available:

Segment Index Item (24 bytes each):

 Offset  Size  Type  Field        Description
 ------  ----  ----  -----------  --------------------------------------
      0     4  U32   length       Length of the segment payload in bytes
      4     4  U32   flags        Bit 0: delete flag (1 = segment
                                  deleted, 0 = segment is valid)
      8     8  U64   objectId     ID of the container object that holds
                                  this segment's payload
     16     8  U64   objectOffset Byte offset of the segment payload
                                  within the container object
Container Objects

A container object holds the raw concatenated payloads of one or more segments. Reading a segment requires fetching the container object, then slicing out bytes [objectOffset, objectOffset+length). The default maximum container size is 4194304 bytes (4 MiB); segments larger than this limit each occupy their own container.

Segments are collected into containers by type, and each type has a write buffer of its own whose size is the maximum size of the containers it produces. The three sizes are settable on every object store - store.folder, store.s3, store.azure and store.objuser - with the same three keywords:

 Keyword  Segment type          Default            Effect
 -------  --------------------  -----------------  ---------------------
 DATBUF   Data segments         4194304 (4 MiB)    Container size for
                                                   segment payloads
 MBRBUF   Member segments       1048576 (1 MiB)    Container size for
                                                   member metadata
 DIRBUF   Directory segment     1 (no buffering)   One container per
                                                   segment

Each of the three can also be set through the environment, which is what a site uses when it cannot change every command:

 Keyword  Environment variable     z/OS system symbol
 -------  -----------------------  -----------------------------------
 DATBUF   FL_OBJSTORE_DATBUF       &FLOSDAT
 MBRBUF   FL_OBJSTORE_MBRBUF       &FLOSMBR
 DIRBUF   FL_OBJSTORE_DIRBUF       &FLOSDIR

The keyword wins over the variable, and the variable over the default. A value that is not a number, is zero, or is above the upper bound of 1042590744 bytes counts as "not set", so the store opens with the next source in that order instead of failing. The bound is deliberately just under 1 GiB: a single allocation of 1 GiB or more is refused as a corrupt size computation, so an inclusive bound of exactly 1 GiB would name a maximum that cannot be used.

Listing Page Size

A listing is answered in pages. Both cloud backends ask for the protocol maximum of 1000 objects per request and follow the continuation the server hands back until the listing is complete, so nothing has to be configured for a store of any size.

 Environment variable     z/OS system symbol   Range
 -----------------------  -------------------  ------------------------
 FL_OBJSTORE_PAGESIZE     none                 1 to 1000, unset = 1000

The variable can only make a page smaller; a value of zero, a value that is not a number, or one at or above 1000 leaves the maximum in place. It exists so that the continuation over several pages can be exercised without first writing a thousand objects, and it has no other use: a smaller page costs one request per page and changes nothing else.

Concurrent Requests

A cloud store does not wait for each object to be stored before it offers the next one: it keeps a number of PUTs in flight at once and prefetches the same number of objects ahead of the reader. The depth is eight and is settable:

 Environment variable     z/OS system symbol   Range
 -----------------------  -------------------  ------------------------
 FL_OBJSTORE_QDEPTH       &FLOSQDP             1 to 32, 0 or unset = 8

A value outside the range is clamped, not refused: a depth is a tuning value, and failing a job because somebody asked for 64 would be the worse answer.

The cost is memory. A queued PUT is held as a copy of the object body, so the store can occupy depth x DATBUF bytes on top of everything else - at the defaults, eight times 4 MiB. Raising both at once multiplies.

Raising the depth pays where the round trip is long and the objects are small, because the waiting overlaps. It stops paying at some point well before the maximum: once enough requests are in flight to keep the link busy, the link is the limit and further depth only costs memory.

This has no effect where FLAM reaches the REST API through the z/OS Client Web Enablement Toolkit. That transport has no asynchronous path, so the store issues one request at a time there whatever the depth says.

DIRBUF has no useful default because there is exactly one directory segment per archive version, so there is nothing to collect: the directory segment goes to the store as its own container object -- which is what the default of 1 expresses, since a segment at least as long as its buffer bypasses the buffer. A value may still be given, but it buys nothing.

Raising DATBUF reduces the number of requests an object store receives, which is the point of it on a cloud store where every request costs a round trip. It also raises the amount of data at risk before a commit and the amount of memory the write buffer occupies. A segment larger than its own buffer is never split: it bypasses the buffer and becomes a container object of its own, whatever its length.

On z/OS the value has one further effect. Where FLAM reaches a REST API through the z/OS Client Web Enablement Toolkit, the transport runs in a helper process and exchanges payload through a shared memory segment; that segment is sized from these values, so a container object normally crosses to the helper in one piece. Nothing has to be configured for that, but the z/OS UNIX IPC limits have to allow a segment of the size DATBUF asks for.

The helper is a program of its own, so z/OS has to be able to reach it when FLAM starts it. In a batch job that means the STEPLIB of the step, and a load library that an earlier step of the SAME job installed or refreshed cannot serve it - install in one job and use FLAM in another. The z/OS installation documentation describes this and the ways around it.

Object Naming

Container objects use a three-level hierarchical name to avoid directories or namespaces with excessive numbers of entries. Given an objectId, the name is constructed as follows:

 sub1 = objectId >> 12         (integer division by 4096)
 sub2 = sub1    >> 12          (integer division by 4096)
 sub1 = sub1 & 0xFFF           (modulo 4096)

 Name = "object." + sub2 + "." + sub1 + "." + objectId

 Examples:
   objectId =         0  ->  object.0.0.0
   objectId =      4096  ->  object.0.1.4096
   objectId =   8388608  ->  object.0.2048.8388608
   objectId = 536870912  ->  object.32.0.536870912

This grouping places up to 4096 container objects in the same sub1 group and up to 4096 sub1 groups in the same sub2 group, yielding a maximum of 4096 * 4096 = 16 777 216 container objects before sub2 overflows.

Access Algorithm

To read a specific segment from the object store:

1. Fetch the object named "root"; verify magic is "FLOM"; byte-swap version, padding, count. 2. Verify CRC32 over bytes 12 through end of the root object. 3. Iterate version pointers from index (count-1) down to 0; find the latest entry with flags bit 0 clear (not deleted). This is the current version. 4. Fetch the object named "index.<id>" for that version's id; verify magic is "FIDX". 5. Decompress the ZSTD-compressed block that follows the 24-byte index header to obtain count segment items (24 bytes each). 6. Verify CRC32 over: bytes 8-23 of the index header (count
mainSegmentId) + all decompressed segment items. 7. The archive root segment is at logical index mainSegmentId. Check that items[mainSegmentId].flags bit 0 is clear. 8. Compute the container object name from items[mainSegmentId].objectId using the naming formula above; fetch that object. 9. Slice out bytes [objectOffset, objectOffset+length) to obtain the raw FL5 segment payload (see segment format appendix).

How a Version Becomes Visible

A new archive version becomes visible through exactly one object: the root. It is written last, as a single whole-object overwrite, so a reader either sees the previous version list or the new one and never a mixture. There is no write-ahead log and no crash recovery beyond that.

The order alone is not the whole guarantee, because a cloud object store may accept an upload and confirm it later. Before FLAM writes an index object or the root, it therefore waits until every container object submitted so far is confirmed stored. Without that wait the root could be acknowledged while an earlier container upload was still on its way to failing, and the new version would point at an object that was never stored. If any upload fails, the index and the root are not written at all: the operation reports the failure and the previously visible version stays intact.

A backend that confirms every write before it returns -- a file system, a folder, an SFTP target, or a provider behind the FOBJ interface -- needs no such wait, and none is performed there.

What the failure leaves behind is unreferenced container objects, not a damaged archive. They are not reachable from any version pointer and are removed by the next PRUNE.

AWS S3 / S3-Compatible Storage Backend

The S3 backend stores segment container objects, index objects, and the root object as individual S3 objects within a single bucket. It supports Amazon S3 as well as any S3-compatible service (MinIO, Ceph, Wasabi, SeaweedFS, etc.) by allowing a custom endpoint URL.

All requests are signed with AWS Signature Version 4 (SigV4). The signing key is derived from the secret access key, the current date, the AWS region, and the service name. The service name is "s3" for every object request; only the AssumeRole call described below is signed with "sts", because AWS verifies the service in the credential scope.

On the command line: the PROVIDER object

The tables below describe the SPI structures, which are flat. The CLEP syntax is not. It separates three things that change at different rates:

store.s3(PROVIDER(ENDPOINT='...' REGION=eu-central-1 ACCESSKEY=... SECRETKEY=...) BUCKET=mybucket PREFIX='hr/2026')

store.azure(PROVIDER(ACCOUNT=myaccount ACCOUNTKEY='...') CONTAINER=archive PREFIX='hr/2026')

store.ibmcda(PROVIDER=myprovider BUCKET=mybucket PREFIX='hr/2026')

All three read the same way. store.ibmcda() differs in one respect and that is deliberate: its PROVIDER is a plain name, because Cloud Data Access keeps everything behind that name in its own configuration and in the caller's credential store. BUCKET and CONTAINER are aliases of each other in all three, so the same wording works whatever the backend calls it.

TIMEOUT is deliberately outside the provider: it says how long THIS run may make no progress, which is a property of the job and not of the service.

Reading a provider from a parameter file

The command line parser reads any object from a file, so:

store.s3(PROVIDER='/etc/flam/awsprod.par' BUCKET=b PREFIX='hr/2026')

with the file holding the parameter list without the brackets. The secret never appears on a command line, which is visible in the process list and in the shell history, and the file can carry its own access rights. On z/OS it may be a data set.

The practical gain is that the same command runs unchanged in a test and in a production environment. Only the provider differs.

Connection Parameters (TsSegStoS3Par)

 Field           Type    Description
 --------------  ------  -----------------------------------------------
 pcEndpoint      string  Custom base URL for the S3 endpoint. If NULL or
                         empty the endpoint is derived from pcRegion and
                         isPathStyle (see Endpoint Derivation below).
                         Use this for non-AWS services or private S3
                         clusters.
 pcRegion        string  AWS region name (e.g., "eu-central-1"). If NULL
                         or empty, falls back to AWS_DEFAULT_REGION env
                         var; default: "us-east-1".
 pcBucket        string  S3 bucket name (required). Falls back to env
                         var FL_S3_BUCKET if NULL or empty.
 pcPrefix        string  Optional prefix prepended to every object key
                         within the bucket (e.g., "archives/prod/").
                         Falls back to FL_S3_PREFIX; default: none.
 pcAccessKey     string  AWS Access Key ID. Falls back to env var
                         AWS_ACCESS_KEY_ID; default: anonymous.
 pcSecretKey     string  AWS Secret Access Key. Falls back to env var
                         AWS_SECRET_ACCESS_KEY.
 pcSessionToken  string  STS temporary session token (optional). When
                         set it is passed as the x-amz-security-token
                         header. Falls back to AWS_SESSION_TOKEN.
 (shared files)  --      When neither the parameters nor the environment
                         name an access key, the shared configuration files
                         are read: ~/.aws/credentials and ~/.aws/config, or
                         the files named by AWS_SHARED_CREDENTIALS_FILE and
                         AWS_CONFIG_FILE, for the profile in AWS_PROFILE
                         ("default" if unset). The credentials file wins over
                         the config file for the same key, as in the AWS
                         SDKs. A profile region is a DEFAULT and does not
                         override a configured one.

                         The triple is taken AS ONE SET, like the parameters
                         and the environment before it: a key from a file is
                         never combined with a token from the environment.

                         A profile may name a credential_process instead of
                         keys: the command is run and its JSON answer is
                         used, which is where AWS SSO and every corporate
                         credential helper plug in -- including "aws sso
                         login", so that flow is reachable without FL5
                         implementing it. The command runs as the job's user,
                         so the file permissions of ~/.aws are part of the
                         security story; it is logged at INFO, and it is
                         refused on a platform with no shell.

                         A profile may name a role_arn with a
                         source_profile: the key of the source profile is
                         then used to assume that role, which is the
                         pcRoleArn path below.

                         AWS SSO itself is deliberately NOT implemented: it
                         is a browser device flow with a cached token and a
                         third endpoint, and a batch job cannot perform the
                         interactive half. credential_process is the
                         supported way to use it.

                         The files are read through the FL5 file layer, so on
                         z/OS a data set or a DD name works as a path and the
                         text is converted into the local character set. A
                         remote URL is refused: reading a credential over a
                         transport that itself needs credentials is a loop.
 pcRoleArn       string  ARN of a role to assume (optional). When set,
                         pcAccessKey and pcSecretKey are the long-term
                         pair used to call STS, and the credentials that
                         sign the object requests are the temporary ones
                         FL5 fetches. Falls back to AWS_ROLE_ARN.
 pcRoleSession   string  Session name for the AssumeRole call; it
                         appears in the provider audit trail. Falls back
                         to AWS_ROLE_SESSION_NAME; default: "flam".
 pcStsEndpoint   string  Base URL of the STS endpoint. Falls back to
                         AWS_STS_ENDPOINT; default: the S3 endpoint.
 uiRoleDuration  U32     Requested lifetime of the temporary credentials
                         in seconds (0 = 3600). The credentials are
                         renewed automatically one minute before they
                         expire. Values below 900 or above 43200 are
                         refused by STS, so FL5 replaces them with the
                         default and says so in a warning.
                         This is the one field with NO environment
                         variable, and that is deliberate: AWS defines
                         none for it. It is a parameter or nothing.
 pcWebIdTokenFile
                 string  Path to a file holding an OIDC token. With
                         pcRoleArn set, FL5 calls
                         AssumeRoleWithWebIdentity and NO key pair is
                         needed: the identity is the token. The file is
                         read at every acquisition, because the platform
                         rewrites it as the token rotates. Falls back to
                         AWS_WEB_IDENTITY_TOKEN_FILE.
 isImds          U32     1 = take the credentials from the instance
                         metadata service. Falls back to FL_S3_IMDS;
                         default: 0.
 isPathStyle     U32     URL style: 1 = path-style
                         (https://s3.<region>.amazonaws.com/<bucket>/...),
                         0 = virtual-hosted-style
                         (https://<bucket>.s3.<region>.amazonaws.com/...).
                         Falls back to FL_S3_PATH_STYLE env var;
                         default: 0 (virtual-hosted).
 uiPort          U32     Port, merged into the endpoint URL. It replaces a
                         port already present there, because it is defined
                         as an override. Everything behind the host name is
                         kept. Falls back to FL_S3_PORT; 0 = the endpoint
                         decides.
 pcCaBundle      str     Trust anchor for the TLS connection: a PEM file on
                         every platform except z/OS, where it is a SAF key
                         ring or key database name. Falls back to
                         FL_CA_BUNDLE; NULL leaves the platform's own store
                         in charge. On z/OS, substituting the anchor needs
                         UPDATE on RST.CABUNDLE when the SAF controls are
                         active -- for the parameter as much as for the
                         environment variable.
 uiTimeout       U32     Seconds a request may make NO PROGRESS; 0 takes
                         the default of 30. Two things have to happen within
                         it: the connection phase -- name resolution, TCP and
                         TLS -- has to complete, and the transfer has to move
                         at least 1 KB/s. A transfer that keeps moving is NOT
                         limited: a large object may take as long as its size
                         and the link require, which is why this is not a
                         deadline for the request.

                         So raise it for an endpoint that is slow to ANSWER,
                         not for one that is slow to transfer -- the second
                         case needs nothing. On z/OS the value becomes the
                         socket send and receive timeout, which is per
                         operation and therefore the same kind of budget.
                         How often a failed request is repeated is a
                         different setting (FL_REST_ATTEMPTS).

Authentication Methods

Authentication is attempted in the following priority order:

1. AssumeRole
Access Key + Secret Key + Role ARN. The key pair is long-term and is used only to call AssumeRole on the STS endpoint. The temporary credentials returned by that call sign every object request, and they are renewed one minute before they expire. This is the recommended form: the long-lived secret never signs an object request, and access can be revoked by changing the role.
2. STS temporary credentials
Access Key + Secret Key + Session Token. The caller has already obtained the credentials elsewhere. The session token is sent as the x-amz-security-token header and is included in the SigV4 signed headers list.
3. Static IAM credentials
Access Key ID + Secret Access Key only (no session token). Standard SigV4 signing.
4. Web identity
Role ARN + a file holding an OIDC token, and nothing else. FL5 calls AssumeRoleWithWebIdentity, which is not signed at all -- there is nothing to sign with, and that is the point: a container reaches the store with no long-term secret existing anywhere, and the platform rotates the assertion underneath it. AWS calls this arrangement IRSA on EKS. The role's trust policy has to accept the OIDC issuer, subject and audience.
5. Instance credentials
no credential at all, only isImds. The machine carries the role. Three endpoints are consulted, in this order: AWS_CONTAINER_CREDENTIALS_FULL_URI, then AWS_CONTAINER_CREDENTIALS_RELATIVE_URI on 169.254.170.2, then the instance metadata service itself. The container forms come first because a machine can have both, and an explicitly injected task role is the more specific statement. IMDSv2 is used where the endpoint offers it, with IMDSv1 only as the fallback.

This mechanism has to be switched on and is never probed for, which is where FL5 differs from the AWS SDKs deliberately. They end their credential chain at 169.254.169.254 whenever nothing else is found; on any machine that is not an instance that probe blocks until it times out, on every single run, and a link-local route can swallow the packet instead of refusing it. A batch program cannot pay that.

Priority when several are configured: a role with a token file wins over a role with keys, which wins over instance credentials. A token file supplied next to a key pair is the more specific statement, and falling back to the keys would silently use a long-term secret where a short-lived one was offered.

Anonymous access (no credentials) is possible if the bucket is public; leave pcAccessKey and pcSecretKey empty and set no environment variables.

The environment is a fallback for each of these forms, but the credentials are resolved AS A SET: if any one of pcAccessKey, pcSecretKey or pcSessionToken is supplied in the struct, none of the three falls back to the environment. Mixing the two sources produces a key that does not belong to its secret, which the service reports as an authentication failure rather than as a configuration error. The role, in contrast, is a target and not a credential, so pcRoleArn resolves independently of where the key pair came from.

Endpoint Derivation

If pcEndpoint is not set and AWS_ENDPOINT_URL is not set in the environment, the endpoint URL is derived automatically:

 isPathStyle=0 (virtual-hosted):
   https://<bucket>.s3.<region>.amazonaws.com

 isPathStyle=1 (path-style):
   https://s3.<region>.amazonaws.com

For S3-compatible services set pcEndpoint to the service base URL (for example "https://minio.example.com:9000") and isPathStyle=1.

Environment Variable Fallbacks

 Variable               Description
 ---------------------  -----------------------------------------------
 FL_S3_BUCKET           Bucket name (required if pcBucket not set)
 AWS_DEFAULT_REGION     AWS region (default: "us-east-1")
 AWS_ENDPOINT_URL       Custom endpoint URL
 FL_S3_PREFIX           Object key prefix
 FL_S3_PATH_STYLE       Set to any non-empty value to enable path-style
                        URLs (equivalent to isPathStyle=1)
 AWS_ACCESS_KEY_ID      Access key ID
 AWS_SECRET_ACCESS_KEY  Secret access key
 AWS_SESSION_TOKEN      STS session token
 AWS_PROFILE            Profile to read out of the shared configuration
                        files (default: "default")
 AWS_SHARED_CREDENTIALS_FILE
                        Overrides ~/.aws/credentials
 AWS_CONFIG_FILE        Overrides ~/.aws/config
 AWS_ROLE_ARN           ARN of the role to assume
 AWS_ROLE_SESSION_NAME  Session name for AssumeRole (default: "flam")
 AWS_STS_ENDPOINT       STS endpoint URL (default: the S3 endpoint)
 FL_S3_PORT             Port, merged into the endpoint URL
 AWS_WEB_IDENTITY_TOKEN_FILE
                        File holding an OIDC token (web identity)
 FL_S3_IMDS             Any non-empty value enables instance credentials
 AWS_CONTAINER_CREDENTIALS_FULL_URI
                        Container credential endpoint (ECS/Fargate, EKS
                        Pod Identity)
 AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
                        Container credential path on 169.254.170.2
 AWS_CONTAINER_AUTHORIZATION_TOKEN
                        Bearer token for the container endpoint
 FL_CA_BUNDLE           Trust anchor: PEM file, or a SAF key ring on z/OS
                        (equivalent to pcCaBundle / CABUNDLE=)

The STS endpoint may not be plain http while the data endpoint is https. The AssumeRole request carries the long-term key and its signature, so allowing that downgrade would let anyone who can set the environment divert those credentials to a host of their choice in the clear. Plain http is accepted when the data endpoint is itself plain http, because there is nothing left to downgrade.

Operational Limits

 Operation    Limit   Description
 ----------   -----   -------------------------------------------------
 ListObjects  1000    Maximum keys returned per page (ListObjectsV2),
                      and what the backend asks for unless
                      FL_OBJSTORE_PAGESIZE says less. It paginates
                      automatically using the continuation token; no
                      caller action required.
 DeleteObjects 1000   Maximum objects per DeleteObjects batch request.
                      The backend issues multiple batch requests
                      automatically if more objects need deletion.

Azure Blob Storage Backend

The Azure backend stores segment container objects, index objects, and the root object as individual blobs within a single blob container. It supports all Azure Blob Storage auth models as well as compatible services (Azurite emulator, private Azure Stack) via a custom endpoint.

All requests carry the Azure REST API version header x-ms-version set to "2020-08-04".

Connection Parameters (TsSegStoAzurePar)

 Field           Type    Description
 --------------  ------  -----------------------------------------------
 pcEndpoint      string  Custom base URL. If NULL or empty, derived
                         automatically as
                         https://<account>.blob.core.windows.net.
                         Falls back to FL_AZURE_ENDPOINT env var.
 pcAccount       string  Storage account name (required). Falls back to
                         AZURE_STORAGE_ACCOUNT env var.
 pcContainer     string  Blob container name (required). Falls back to
                         FL_AZURE_CONTAINER env var.
 pcPrefix        string  Optional prefix prepended to every blob name
                         (e.g., "archives/prod/"). Falls back to
                         FL_AZURE_PREFIX; default: none.
 pcAccountKey    string  Base64-encoded storage account key (SharedKey
                         auth). Falls back to AZURE_STORAGE_KEY env var.
 pcSasToken      string  Pre-signed Shared Access Signature query string
                         appended to every request URL. Falls back to
                         AZURE_STORAGE_SAS_TOKEN. Alternative to
                         pcAccountKey; HTTP 403 on expiry returns
                         FLMRTC_AUT with a clear expiry message.
 pcClientId      string  Azure AD application (client) ID for OAuth2
                         client credentials auth. Falls back to
                         AZURE_CLIENT_ID env var.
 pcClientSecret  string  Azure AD client secret. Falls back to
                         AZURE_CLIENT_SECRET env var.
 pcTenantId      string  Azure AD tenant (directory) ID. Falls back to
                         AZURE_TENANT_ID env var.
 pcFedTokenFile  string  Path to a file holding a client assertion (a
                         JWT from an external OIDC provider), used
                         instead of pcClientSecret. This is Azure
                         workload identity: no shared secret sits in the
                         configuration and the credential expires on its
                         own. Chosen over pcClientSecret when both are
                         given, because an explicitly offered short-lived
                         credential must not lose to a long-term one.
                         Read at every acquisition, because the platform
                         rewrites the file as it rotates. Falls back to
                         AZURE_FEDERATED_TOKEN_FILE.
 pcCertFile      string  Path to a PEM or PKCS 12 file holding a
                         certificate AND its private RSA key, used
                         instead of pcClientSecret. FL5 then builds a JWT
                         client assertion itself and signs it with RS256
                         through the CryCore. The certificate has to be in
                         the same file, because the assertion carries its
                         SHA-256 thumbprint and Entra ID matches that
                         against the app registration -- a bare private
                         key is refused with that reason. Chosen over
                         pcClientSecret when both are given, for the same
                         reason pcFedTokenFile is. Validated at open, so a
                         wrong file or passphrase is reported before the
                         first request rather than after an archive has
                         been written. Read through the FL5 file layer, so
                         on z/OS a data set or a DD name works as a path; a
                         remote URL is refused. The same holds for
                         pcFedTokenFile. Falls back to
                         AZURE_CLIENT_CERTIFICATE_PATH.
 pcCertPass      string  Passphrase for pcCertFile. NEVER taken from the
                         environment: unlike an account key there is no
                         convention that would make the exposure worth it,
                         and it unlocks a private key. Never prompted for
                         either, because this runs in batch.

                         On z/OS it is converted to ASCII before it reaches
                         the key file, because that is the character set the
                         file was encrypted with -- a PEM or PKCS 12 export
                         comes from a distributed system and the decryption
                         key is derived from the password BYTES. A passphrase
                         therefore has to consist of ASCII characters; one
                         outside that range cannot be represented and the
                         file will not open.
 pcCertLabel     string  RESERVED for a key held by the FKM5 key manager
                         (ICSF, PKCS 11 or the software keystore), where
                         the private key never leaves the device. Accepted
                         by the parser and refused at open until FKM5 is
                         wired in, so that the syntax already documents
                         where it will plug in. Together with pcCertFile
                         it is a configuration error: one key, one place.
 uiPort          U32     Port, merged into the endpoint URL. It replaces a
                         port already present there, because it is defined
                         as an override. Everything behind the host name is
                         kept, which matters here: an emulator puts the
                         account name in the path. Falls back to
                         FL_AZURE_PORT; 0 = the endpoint decides.
 pcCaBundle      str     Trust anchor for the TLS connection: a PEM file on
                         every platform except z/OS, where it is a SAF key
                         ring or key database name. Falls back to
                         FL_CA_BUNDLE; NULL leaves the platform's own store
                         in charge. Substituting the anchor needs UPDATE on
                         RST.CABUNDLE where the SAF controls are active.
 uiTimeout       U32     Seconds a request may make NO PROGRESS; 0 takes
                         the default of 30 -- see the note on the same field
                         of the S3 store above for what that budgets.

Authentication Methods

Authentication mode is selected at open time in the following priority order:

1. OAuth2 client credentials
Activated when pcClientId is set (or AZURE_CLIENT_ID is present). Fetches a Bearer token from the Azure AD token endpoint: POST https://login.microsoftonline.com/<tenantId>/ oauth2/v2.0/token with client_id, client_secret, and scope https://storage.azure.com/.default. The token is refreshed automatically when it expires (HTTP 401).
2. SAS token
Activated when pcSasToken is set (or AZURE_STORAGE_SAS_TOKEN is present). The SAS query string is appended to every request URL. Only date and x-ms-version headers are sent; no Authorization header is generated. An HTTP 403 response returns FLMRTC_AUT with a message that the SAS token may have expired.
3. Managed Service Identity (MSI)
Activated automatically when no account key is configured and OAuth2 is not in use. Fetches a Bearer token from the Azure Instance Metadata Service (IMDS) at: GET http://169.254.169.254/metadata/identity/oauth2/token ?api-version=2018-02-01&resource=https://storage.azure.com/ The IMDS endpoint can be overridden via FL_IMDS_ENDPOINT for testing (e.g., when using Azurite or a local IMDS mock). Only works inside Azure VMs, AKS pods, and App Service instances with a managed identity configured; timeout is 5 seconds.
4. SharedKey HMAC-SHA256
Default when pcAccountKey is set (or AZURE_STORAGE_KEY is present). The canonicalized string-to-sign is computed per the Azure SharedKey Lite specification and signed with HMAC-SHA256 using the Base64-decoded account key.

Environment Variable Fallbacks

 Variable                  Description
 ------------------------  ---------------------------------------------
 AZURE_STORAGE_ACCOUNT     Storage account name (required if pcAccount
                           not set)
 FL_AZURE_CONTAINER        Blob container name (required if pcContainer
                           not set)
 AZURE_STORAGE_KEY         Base64-encoded account key (SharedKey auth)
 AZURE_STORAGE_SAS_TOKEN   Pre-signed SAS query string (SAS auth)
 AZURE_CLIENT_ID           Azure AD client ID (OAuth2 auth)
 AZURE_CLIENT_SECRET       Azure AD client secret (OAuth2 auth)
 AZURE_TENANT_ID           Azure AD tenant ID (OAuth2 auth)
 AZURE_FEDERATED_TOKEN_FILE
                           File holding the client assertion (workload
                           identity auth)
 AZURE_CLIENT_CERTIFICATE_PATH
                           PEM or PKCS 12 file with the certificate and
                           its private key (certificate auth). The
                           passphrase is NOT taken from the environment.
 FL_AZURE_PREFIX           Blob name prefix
 FL_AZURE_ENDPOINT         Custom endpoint base URL
 FL_AZURE_PORT             Port, merged into the endpoint URL
 FL_IMDS_ENDPOINT          IMDS base URL override (default:
                           http://169.254.169.254); for testing only
 FL_AZURE_AUTHORITY        Azure AD token endpoint override (default:
                           https://login.microsoftonline.com); must be an
                           https URL and needs its own RST.CONNECT permit
                           where SAF is active; for testing only
 FL_CA_BUNDLE              TLS trust anchor when no parameter names one: a
                           PEM file, or a SAF keyring or key database name
                           on z/OS. store.s3(CABUNDLE=) and
                           store.azure(CABUNDLE=) take precedence; both
                           sources need UPDATE on RST.CABUNDLE where the
                           SAF controls are active

Operational Limits

 Operation    Limit   Description
 ----------   -----   -------------------------------------------------
 ListBlobs    1000    Maximum blobs returned per page, and what the
                      backend asks for unless FL_OBJSTORE_PAGESIZE says
                      less. It paginates automatically using the
                      nextMarker continuation token; no caller action
                      required.
 DeleteBlob   256     Container objects are deleted via the Azure Blob
                      Batch API (POST /?comp=batch, up to 256 blobs per
                      request). The backend falls back to individual
                      DELETE requests if the batch endpoint is
                      unavailable; no caller action required.

IBM z/OS Cloud Data Access Backend

Reached through store.ibmcda(), on z/OS only. Unlike the two native cloud backends this one does not speak to the provider itself: it hands the operation to the DFSMSdfp Cloud Data Access component, which owns the endpoint, the TLS material and the credentials. That is the whole point of it -- a site that has CDA configured describes its clouds once, in a provider file written by the system programmer, and does not describe them again in a FLAM command.

Connection Parameters (TsSegStoIbmCdaPar)

 Field         Keyword    Description
 -----------   --------   ---------------------------------------------
 pcProvider    PROVIDER   CDA provider name, the basename of its .json
                          file. Required. At most 20 characters
                          (GDK_MAX_PROVIDER_NAME_LEN) and case
                          sensitive.
 pcBucket      BUCKET     Bucket or container inside that provider.
                          Required. CDA folds it to lower case.
 pcPrefix      PREFIX     Object key prefix within the bucket. Optional.
 isAltCred     ALTCRED    Ask for the alternate credential pair. Refused
                          at present -- see below.

There is deliberately no ENDPOINT, REGION, ACCESSKEY or SECRETKEY. Those live in the provider file and in CDA's encrypted credential store, and passing one here is an error rather than a value that is silently ignored.

What the Provider File Has to Define

The provider file is a driver: it describes the endpoint's whole REST API, so it is derived from one of the samples in /usr/lpp/dfsms/gdk/samples/providers/ rather than written by hand. Two of its properties decide whether a segment store works at all, and neither produces a message that points at the file.

HEADOBJECT must be among the supportedOperations. Asking whether an object exists makes CDA HEAD the name first, to tell an object from a directory, and without that operation it refuses the call with `Unsupported operation <HEADOBJECT>` -- which affects every existence check and every read that has to measure the object first. Of the shipped S3 samples only IBMCOS.json defines it; S3CLOUD.json stops at the six data operations, and so does AZURE.json. So derive an S3 provider from IBMCOS.json, and for any other endpoint add the operation to the derived file by hand -- the endpoint template, HEAD, and that provider's own request headers. It needs no responseResults; IBM's own HEADOBJECT has none.

modifiedTimeFormat in the LISTOBJECT response has to match what the endpoint actually sends. The samples ask for fractional seconds (%y-%m-%dT%H:%M:%S.???Z); an endpoint that sends whole seconds produces one Expected '.', not 'Z', when parsing time. on stderr per listed object, in every build. Dropping the .??? from the format ends it.

CDA also reports Bad HTTP status code 404 on stderr for every object that is asked about and is not there. A segment store does that as a matter of course, so the line is normal; the return code is what FLAM acts on. Neither message can be turned off through log-level in gdkconfig.json.

Authentication Methods

None of FLAM's own. Credentials are stored per RACF user, per provider and per resource by the CDA authorization utility or by its API (GDKKEYAD, or the JSON form gdkkeyadJ / gdkkeyad64J), encrypted under an ICSF key with the label GDK.<userid>.<provider>.Annnnn. FLAM never sees them and never writes the key file.

Two properties of that store surprise often enough to be worth naming: a generic key is held against the resource "/" and there is only one per provider, a second overwriting the first; and a bucket-specific key is held against "/<bucket>" and takes precedence over the generic one.

ALTCRED is refused rather than ignored. The utility can mark a pair as the alternate one, but the optional parameters of GDKGET and GDKWRITE have no documented key to select it, and quietly using the primary pair instead would be worse than an error.

Environment Variable Fallbacks

 Keyword     Environment variable
 ---------   ----------------------------------------------------------
 PROVIDER    FL_CDA_PROVIDER
 BUCKET      FL_CDA_BUCKET
 PREFIX      FL_CDA_PREFIX

Operational Limits

 Operation    Limit   Description
 ----------   -----   -------------------------------------------------
 Object name  100     GDK_MAX_OBJECT_NAME_LEN. The composed name is
                      /bucket/prefix/key, and the backend rejects a
                      longer one with a message naming how much PREFIX
                      has to shrink by -- CDA does not check it, and a
                      truncated name addresses a different object.
 Session      opt     GDKINIT/GDKTERM where the installed level has
                      them: one session per open, which saves a
                      provider file read, a key file read and a
                      handshake on every object. A level without them
                      answers X'F02' and every operation stands on its
                      own, as before. FL_CDA_SESSION=OFF asks for the
                      standalone form on any level. open() probes the
                      bucket either way, so a wrong provider or a
                      missing credential is reported at open time.
 Metadata     none    There is no HEAD equivalent. Existence and length
                      come from GDKLIST on the object name.
 Listing      capped  There is no continuation token at this level, so a
                      capped answer is reported as incomplete rather
                      than paged through.

Data is transferred through GDK_BUFFER_DATALOCATION, and AutoConvert is passed as "false" on every transfer. That is not a default being restated: the option overrides both the built-in default and the value in config.json, so a site that switched translation on would otherwise have every archive segment converted on the way through, which is a corrupt archive.

FSEG: Segment Store Service Provider Interface

The FSEG SPI allows a customer to connect an arbitrary storage backend to the FLAM5 segment store layer. Any key/value or block-addressable storage system can serve as the physical archive medium; FLAM handles all member management, versioning, and compression. The provider only needs to implement a small set of integer-keyed blob operations.

The SPI is activated by the CLEP qualifier:

store.seguser(
    LIBRARY='libfsse',
    FUNC='FSEGUSR',
    PARAMETER='...',
    TRACE)

FLAM ships a reference implementation (libfsse / FSEGUSR) that wraps the built-in flat-file segment store. A customer-facing coding template is provided in CSRC/SAMPLE/FSEGODB.c, demonstrating how to back the SPI with an ODBC-accessible database (PostgreSQL, MySQL, SQL Server, DB2, SQLite).

Interface Version

 Constant        Value   Meaning
 --------------  ------  -----------------------------------------------
 FSEG_VERSION    0x0200  Current interface version (major=2, minor=0)

The caller (SEGSSE bridge) passes &FSEG_VERSION as the piVersion argument on every call. The provider compares the major byte (*piVersion >> 8) against its own compiled-in major version; a mismatch must return an error from FSEG_FUNC_OPN.

Version history:

 Version  Changes
 -------  -------------------------------------------------------------
 0x0100   Initial release. Function codes 1-13 (OPN-CBF). TsFsegCls
          had an isDel field (removed in 0x0102).
 0x0101   Added FSEG_FUNC_FLB (14) and uiSegCnt in TsFsegFlb.
          Added isExists + uiRes0 to TsFsegExs.
 0x0102   Added uiDelLen (deleted segment size output) and uiRes0
          (alignment pad) to TsFsegDel. Removed obsolete fields from
          TsFsegCls, TsFsegDvs, TsFsegDar, TsFsegPrn, TsFsegVsnEnt.
 0x0103   Added FSEG_FUNC_PRB (15) composite probe and TsFsegPrb.
 0x0200   BREAKING: TsFsegOpn compacted. uiParLen moved adjacent to
          uiNamLen (before the first pointer); uiRes0 and uiRes1 removed.
          Both pointers remain 8-byte-aligned.
          Added FSEG_FUNC_NEW (16) and FSEG_FUNC_FRE (17); removed
          FSEG_FUNC_PRB (15) and TsFsegPrb.
          FSEG_FUNC_CLS no longer frees the provider handle; that is
          now the exclusive responsibility of FSEG_FUNC_FRE.
          FSEG_FUNC_EXS, FSEG_FUNC_DAR, and FSEG_FUNC_PRN now operate
          in NEW state (provider self-manages the internal connection).

Provider Entry Point

The provider DLL/SO must export exactly one function with this signature:

void FSEGUSR(
    void*               pvGbl,      /* [in]     FLAM global handle     */
    void**              ppHdl,      /* [in/out] provider handle        */
    int*                piRetco,    /* [out]    return code (0=ok)     */
    const unsigned int* piVersion,  /* [in]     FSEG_VERSION           */
    const unsigned int* piFunc,     /* [in]     FSEG_FUNC_* code       */
    TuFsegPar*          puPara,     /* [in/out] function parameters    */
    const unsigned int* piMsgSiz,   /* [in]     pcMsg buffer capacity  */
    char*               pcMsg)      /* [out]    error/info message     */

The exported name defaults to "FSEGUSR"; it is overridable via the FUNC= parameter of store.seguser() or the FL_FSEG_FUNCTION env var.

ppHdl is NULL on the first NEW call. The provider allocates a handle and writes its address to *ppHdl. All subsequent calls receive the same pointer until FRE, at which point the provider must free the handle and set *ppHdl = NULL. CLS closes the storage connection but does NOT free the handle.

On success set *piRetco = 0. On error set *piRetco to any non-zero value and write a diagnostic string to pcMsg. The SEGSSE bridge translates any non-zero provider RC to FLMRTC_FSG and includes the provider RC and pcMsg in the FLAM error trace.

Providers must not use or rely on FLMRTC_* values from FLMRTC.h; these are internal FLAM reason codes and are not part of the SPI contract.

Lifecycle

The provider handle and the storage connection are managed separately:

 State: EMPTY (ppHdl == NULL)
   |
   | FSEG_FUNC_NEW   allocate handle; store name+params (no I/O)
   v
 State: NEW (handle allocated, storage not connected)
   |                       |
   | FSEG_FUNC_OPN         | FSEG_FUNC_EXS / DAR / PRN
   v                       | (stateless; provider self-manages connection)
 State: OPEN               v
   |                    State: NEW
   | FSEG_FUNC_PUT/GET/DEL/GMN/SMN/CBF/FLB/VLS/DVS
   |
   | FSEG_FUNC_CLS   disconnect; handle returns to NEW state
   v
 State: NEW
   |
   | FSEG_FUNC_FRE   free handle; ppHdl = NULL
   v
 State: EMPTY

EXS, DAR, and PRN operate in NEW state: the provider opens a temporary connection internally, executes the operation, and closes before returning. VLS and DVS require OPEN state. FSEG_FUNC_CLS closes the storage connection but does NOT free the handle. Every session must end with FSEG_FUNC_FRE.

Function Codes

 Code  Name          Key parameters                  Semantics
 ----  ------------  ------------------------------  -------------------
    1  FSEG_FUNC_OPN uiFlg, siVerId, pcNamStr,       Open/connect (OPEN
                     pcParStr -> ppcName,             state). Requires
                     siOpenedVerId                    prior NEW. siVerId
                                                      =-1+WRITE: new ver.
                                                      siVerId=-1+READ:
                                                      latest version.
    2  FSEG_FUNC_CLS isCommit -> uiTotalBytesWritten Disconnect (OPEN ->
                     uiSegmentBytesWritten            NEW). Does NOT free
                                                      the handle; that is
                                                      FSEG_FUNC_FRE.
    3  FSEG_FUNC_PUT uiSegTyp, uiSegLen, pcSegDat    Store a segment blob;
                     -> siSegInd                      provider assigns the
                                                      integer index.
                                                      OPEN state only.
    4  FSEG_FUNC_GET siSegInd -> uiSegLen, ppSegDat  Locate-semantics GET;
                                                      provider-owned buffer
                                                      valid until next GET
                                                      or CLS. OPEN state.
    5  FSEG_FUNC_DEL siSegInd -> uiDelLen            Delete segment by
                                                      index. OPEN state.
    6  FSEG_FUNC_EXS siSegInd -> isExists            Dual-mode: in NEW
                                                      state checks archive
                                                      existence (siSegInd
                                                      ignored). In OPEN
                                                      state checks segment
                                                      existence.
    7  FSEG_FUNC_GMN -> siSegInd                     Return main/root
                                                      segment index; return
                                                      FSEG_IDX_INI if not
                                                      set. OPEN state.
    8  FSEG_FUNC_SMN siSegInd                        Persist main/root
                                                      segment index.
                                                      OPEN state.
    9  FSEG_FUNC_VLS -> uiVsnCnt, psVsnEnt           List all versions.
                                                      Provider allocates
                                                      array; FLAM frees
                                                      with free().
                                                      OPEN state.
   10  FSEG_FUNC_DVS siVerId -> uiVerDel             Delete one version.
                                                      OPEN state.
   11  FSEG_FUNC_DAR -> uiVerDel                     Delete entire archive
                                                      (all versions).
                                                      NEW state only;
                                                      provider manages
                                                      internal connection.
   12  FSEG_FUNC_PRN uiKeepCnt -> uiVerDel           Prune: keep N most
                                                      recent versions.
                                                      NEW state only;
                                                      provider manages
                                                      internal connection.
   13  FSEG_FUNC_CBF uiMaxSiz -> uiBufId             Create write buffer
                                                      (batch hint). Return
                                                      uiBufId=0 for no-op.
                                                      OPEN state.
   14  FSEG_FUNC_FLB uiBufId, uiSegCnt               Flush write buffer.
                                                      OPEN state.
   16  FSEG_FUNC_NEW uiNamLen, pcNamStr,              Allocate provider
                     uiParLen, pcParStr               handle; store name
                                                      and params. No I/O.
                                                      EMPTY -> NEW.
   17  FSEG_FUNC_FRE (no input fields)               Free provider handle.
                                                      No I/O. NEW -> EMPTY.
                                                      Provider must set
                                                      *ppHdl = NULL.

Flags (uiFlg in TsFsegOpn)

 Flag                 Hex        Direction  Description
 -------------------  ---------  ---------  ---------------------------
 FSEG_FLAG_WRITE      0x00000001 INPUT      Write access; 0 = read-only
 FSEG_FLAG_OVERWRITE  0x00000002 INPUT      Reset to empty archive on OPN
 FSEG_FLAG_LOG        0x00000004 INPUT      Info-level logging enabled
 FSEG_FLAG_DEBUG      0x00000008 INPUT      Debug logging (needs LOG)
 FSEG_FLAG_TRACE      0x00000010 INPUT      Debug trace output
 FSEG_FLAG_ACCESS     0x00000040 INPUT      SAF/RACF checks active (z/OS)
 FSEG_FLAG_STRONG     0x00000080 INPUT      RACF strict mode (MUSTDEF);
                                            combined with ACCESS only
 FSEG_FLAG_VERSIONED  0x00000100 INPUT      Versioning enabled; VLS/DVS/
                                            DAR/PRN may be called

On z/OS: FSEG_FLAG_ACCESS signals that RACF checked the library name (FSEGLIB resource class) and function name (FSEGFUC resource class) at READ level. FSEG_FLAG_STRONG additionally means RACF is in strict mode (GLOBAL.MUSTDEF = UPDATE or lower), so an undefined resource causes abort rather than silent acceptance. External providers may ignore both flags.

Segment Type Markers (uiSegTyp in TsFsegPut)

 Constant         Value  Description
 ---------------  -----  -----------------------------------------------
 FSEG_SEGTYP_DAT  1      Raw compressed member data segment
 FSEG_SEGTYP_MBR  2      Member descriptor segment (metadata)
 FSEG_SEGTYP_DIR  3      Directory segment (archive-level index)

Providers may use these markers to apply different storage strategies per type (separate buckets, compression hints, etc.).

Special Segment Index Values

 Constant       Value  Description
 -------------  -----  -------------------------------------------------
 FSEG_IDX_INI   -1     Not yet initialized / no main segment set (GMN)
 FSEG_IDX_EMPTY -2     Represents an empty (zero-length) member

Default Provider Binding

 Default library name:    libfsse    (override: FL_FSEG_LIBRARY env var)
 Default function name:   FSEGUSR    (override: FL_FSEG_FUNCTION env var)
 Default parameter:       (none)     (override: FL_FSEG_PARAMETER env var)

Threading Model

Each open handle is used by a single thread only; the provider does not need per-handle locking. Multiple handles to the same archive namespace may be active simultaneously; the provider is responsible for namespace-level concurrency control (e.g., advisory file locks or database transactions).

z/OS Heap Sharing (VLS / psVsnEnt)

The VLS call requires the provider to allocate an array with malloc() and FLAM to free it with free(). On z/OS, malloc/free across DLL boundaries may use different C runtime heaps. To avoid corruption: link both the provider DLL and FLAM against the LE shared runtime (CEEPLPKA), or return psVsnEnt=NULL and uiVsnCnt=0 if version enumeration is not supported.

FOBJ: Object Store Service Provider Interface

The FOBJ SPI allows a customer to connect an arbitrary string-keyed object store to the FLAM5 segment store layer at the object level. Cloud blob stores (S3, Azure Blob Storage, GCS), content-addressable stores, or any key/value store with string keys can serve as the physical archive medium. FLAM handles versioning, buffering, member management, and compression; the provider only implements a small set of string-keyed object operations.

The SPI is activated by the CLEP qualifier:

store.objuser(
    LIBRARY='libfsse',
    FUNC='FOBJUSR',
    PARAMETER='...',
    TRACE)

FLAM ships a reference implementation (libfsse / FOBJUSR) that wraps the built-in folder object store. A customer-facing coding template is provided in CSRC/SAMPLE/FOBJCLD.c, demonstrating how to back the SPI with an S3-compatible cloud store via libcurl.

Key Difference from FSEG

The FSEG SPI is integer-keyed: FLAM assigns a segment index (int64) and the provider must map that index to a persistent blob. The FOBJ SPI is string-keyed: FLAM generates an opaque ASCII key for each object and passes it on every call. The provider only needs a flat key/value store. Versioning is handled by SEGOBJ above the FOBJ layer by embedding the version ID into every object key as a namespace prefix; the provider sees only a single flat namespace per OPN session.

Object Key Format

Object keys are null-terminated ASCII strings generated by the SEGOBJ layer. Keys consist of printable ASCII characters only (no slashes, spaces, or control characters). The format is opaque to the provider; keys are unique within a namespace and contain the version ID embedded as a prefix, so no additional version tracking is needed at provider level.

Interface Version

 Constant        Value   Meaning
 --------------  ------  -----------------------------------------------
 FOBJ_VERSION    0x0201  Current interface version (major=2, minor=1)

The caller (OBJSSE bridge) passes &FOBJ_VERSION as the piVersion argument on every call. The provider must compare the major byte (*piVersion >> 8) against its own compiled-in major version; a mismatch must return an error from FOBJ_FUNC_OPN.

Version history:

 Version  Changes
 -------  -------------------------------------------------------------
 0x0100   Initial release. Function codes 1-7 (OPN-DST).
 0x0200   BREAKING: TsFobjOpn compacted. uiParLen moved adjacent to
          uiNamLen (before the first pointer); uiRes0 and uiRes1
          removed. Both pointers remain 8-byte-aligned.
          Added FOBJ_FUNC_EXS (8), FOBJ_FUNC_NEW (9), FOBJ_FUNC_FRE
          (10). FOBJ_FUNC_CLS no longer frees the handle; that is now
          the responsibility of FOBJ_FUNC_FRE. FOBJ_FUNC_DST and
          FOBJ_FUNC_EXS operate in NEW state.
 0x0201   Additive: uiMaxObjLen carries the largest object the store has
          to expect, as SEGOBJ derived it from the largest of DATBUF,
          MBRBUF and DIRBUF. In TsFobjOpn it takes over the 4-byte
          alignment slot that was a dummy pad, so that struct keeps its
          layout; in TsFobjNew it is appended, because a provider that
          pre-allocates buffers does so in FOBJ_FUNC_NEW. It is a hint
          for sizing and never a bound - a provider must still accept a
          larger object, and may ignore the field. A provider built
          against 0x0200 keeps working unchanged.

Provider Entry Point

The provider DLL/SO must export exactly one function with this signature (identical layout to FSEG):

void FOBJUSR(
    void*               pvGbl,      /* [in]     FLAM global handle     */
    void**              ppHdl,      /* [in/out] provider handle        */
    int*                piRetco,    /* [out]    return code (0=ok)     */
    const unsigned int* piVersion,  /* [in]     FOBJ_VERSION           */
    const unsigned int* piFunc,     /* [in]     FOBJ_FUNC_* code       */
    TuFobjPar*          puPara,     /* [in/out] function parameters    */
    const unsigned int* piMsgSiz,   /* [in]     pcMsg buffer capacity  */
    char*               pcMsg)      /* [out]    error/info message     */

ppHdl is NULL on the first NEW call. The provider allocates a handle and writes its address to *ppHdl. All subsequent calls receive the same pointer until FRE, at which point the provider must free the handle and set *ppHdl = NULL. CLS closes the storage connection but does NOT free the handle.

Lifecycle

 State: EMPTY (ppHdl == NULL)
   |
   | FOBJ_FUNC_NEW   allocate handle; store name+params (no I/O)
   v
 State: NEW
   |                       |
   | FOBJ_FUNC_OPN         | FOBJ_FUNC_DST / FOBJ_FUNC_EXS
   v                       | (provider self-manages connection)
 State: OPEN               v
   |                    State: NEW
   | FOBJ_FUNC_GET/PUT/DEL/CHK
   |
   | FOBJ_FUNC_CLS   disconnect; handle returns to NEW state
   v
 State: NEW
   |
   | FOBJ_FUNC_FRE   free handle; ppHdl = NULL
   v
 State: EMPTY

FOBJ_FUNC_DST and FOBJ_FUNC_EXS operate in NEW state; the provider manages any temporary connection internally. FOBJ_FUNC_CLS does NOT free the handle.

Function Codes

 Code  Name          Key parameters                  Semantics
 ----  ------------  ------------------------------  -------------------
    1  FOBJ_FUNC_OPN uiFlg, siVerId (always -1),     Open/connect to the
                     pcNamStr, pcParStr               namespace. siVerId
                     -> ppcName                       is always -1; the
                                                      SEGOBJ layer encodes
                                                      versions in object
                                                      keys. Provider may
                                                      ignore siVerId.
    2  FOBJ_FUNC_CLS isCommit                         Commit (1) or roll
                                                      back (0) all writes.
                                                      No byte-count stats
                                                      are requested (unlike
                                                      FSEG CLS).
    3  FOBJ_FUNC_GET uiKeyLen, pcKeyStr               Locate-semantics:
                     -> uiDatLen, ppDatPtr            provider returns
                                                      pointer to its own
                                                      buffer, valid until
                                                      next GET or CLS.
                                                      Return FOBJ_RTC_NFD
                                                      (1) if object does
                                                      not exist; OBJSSE
                                                      maps this to
                                                      FLMRTC_NFD.
    4  FOBJ_FUNC_PUT uiKeyLen, uiDatLen, pcKeyStr,    Store object under
                     pcDatPtr                         the given key.
    5  FOBJ_FUNC_DEL uiKeyLen, pcKeyStr               Delete object by key.
    6  FOBJ_FUNC_CHK uiKeyLen, uiMinLen, pcKeyStr     Check existence and
                     -> isExists, isTooShort          minimum size. isExists
                                                      = 1 if the object
                                                      exists AND its length
                                                      >= uiMinLen; else 0.
                                                      With isExists=0,
                                                      isTooShort=1 means it
                                                      is there but shorter,
                                                      0 means it is absent.
                                                      OBJSSE maps the two to
                                                      FLMRTC_RNG and
                                                      FLMRTC_ONF. A provider
                                                      that cannot tell them
                                                      apart leaves it at 0.
    7  FOBJ_FUNC_DST (no input fields)                Delete entire store
                                                      namespace. NEW state
                                                      only; provider manages
                                                      internal connection.
    8  FOBJ_FUNC_EXS uiKeyLen, pcKeyStr               Check if object key
                     -> isExists                      exists. NEW state;
                                                      provider manages
                                                      internal connection.
    9  FOBJ_FUNC_NEW uiNamLen, pcNamStr,              Allocate provider
                     uiParLen, pcParStr               handle; store name
                                                      and params. No I/O.
                                                      EMPTY -> NEW.
   10  FOBJ_FUNC_FRE (no input fields)               Free provider handle.
                                                      No I/O. NEW -> EMPTY.
                                                      Provider must set
                                                      *ppHdl = NULL.

Reserved Return Codes

 Code           Value  Description
 -------------  -----  -------------------------------------------------
 FOBJ_RTC_OK    0      Success. Must be returned for every successful call.
 FOBJ_RTC_NFD   1      Object not found. Only valid from FOBJ_FUNC_GET.
                        OBJSSE maps this to FLMRTC_NFD so SEGOBJ can
                        distinguish a new/empty archive (missing root
                        object) from a genuine I/O error. All other
                        non-zero values are mapped to FLMRTC_FOB.

Flags (uiFlg in TsFobjOpn)

The flag values and semantics are identical to the FSEG SPI (see FSEG Flags section above), with FOBJ_ prefix replacing FSEG_:

 Flag                 Hex        Direction  Description
 -------------------  ---------  ---------  ---------------------------
 FOBJ_FLAG_WRITE      0x00000001 INPUT      Write access; 0 = read-only
 FOBJ_FLAG_OVERWRITE  0x00000002 INPUT      Reset to empty store on OPN
 FOBJ_FLAG_LOG        0x00000004 INPUT      Info-level logging enabled
 FOBJ_FLAG_DEBUG      0x00000008 INPUT      Debug logging (needs LOG)
 FOBJ_FLAG_TRACE      0x00000010 INPUT      Debug trace output
 FOBJ_FLAG_ACCESS     0x00000040 INPUT      SAF/RACF checks active (z/OS)
                                            Resource classes: FOBJLIB,
                                            FOBJFUC; controlled by
                                            GLOBAL.OBU.CONTROL
 FOBJ_FLAG_STRONG     0x00000080 INPUT      RACF strict mode (MUSTDEF);
                                            combined with ACCESS only

Note: FOBJ has no FOBJ_FLAG_VERSIONED. Version management is handled by the SEGOBJ layer above; the provider always sees a flat namespace.

Default Provider Binding

 Default library name:    libfsse    (override: FL_FOBJ_LIBRARY env var)
 Default function name:   FOBJUSR    (override: FL_FOBJ_FUNCTION env var)
 Default parameter:       (none)     (override: FL_FOBJ_PARAMETER env var)

SEGSTOR Dispatcher

The segment store dispatcher (SEGSTOR.c) translates a top-level SegmentStoreParams structure into one of three concrete backend implementations. The CLEP keyword determines which method is selected:

 Method constant                 Value  CLEP keyword     Backend
 ------------------------------  -----  ---------------  ---------------
 SEGMENT_STORE_METHOD_OBJECTS      1    store.s3()       SEGOBJ + OBJCLDS3
                                        store.azure()    SEGOBJ + OBJCLDAZ
                                        store.folder()   SEGOBJ + OBJFLDR
                                        store.objuser()  SEGOBJ + OBJSSE
 SEGMENT_STORE_METHOD_FLATFILE     2    store.flatfile() SEGFILE
 SEGMENT_STORE_METHOD_USER         3    store.seguser()  SEGSSE

For SEGMENT_STORE_METHOD_OBJECTS, a second-level object method code selects the object backend:

 Object method constant           Value  CLEP keyword
 ------------------------------   -----  --------------------------------
 SEGMENT_OBJECTS_METHOD_FOLDER      1    store.folder()
 SEGMENT_OBJECTS_METHOD_CS3         2    store.s3()
 SEGMENT_OBJECTS_METHOD_CAZ         3    store.azure()
 SEGMENT_OBJECTS_METHOD_USER       10    store.objuser()

Open Modes

Every backend receives an open-mode code that controls access semantics:

 Constant                 Value  Semantics
 -----------------------  -----  ----------------------------------------
 SEGSTORE_READ              1    Read-only; open existing version.
                                 siVersionId selects which version to open:
                                 0 = newest, -1 = previous, -2 = older, ...
 SEGSTORE_CREATE            2    Create new archive; fails if archive exists
                                 and FSEG_FLAG_OVERWRITE is not set.
 SEGSTORE_UPDATE            3    Add or delete segments in the latest version.
                                 siVersionId must be 0.
 SEGSTORE_VERSION_LIST      4    Version management: read root only, no index.
                                 Used by list-version operations.
 SEGSTORE_VERSION_DELETE    5    Version management: delete a specific version.
                                 Implies write access.

When close() is called in write modes (CREATE or UPDATE), a non-zero isCommit argument commits the new index. A zero isCommit rolls back the session: no new index is written and any segments already written are left inaccessible until overwritten by a future write operation.

SEGSSE: FSEG SPI Bridge

SEGSSE (CSRC/SEGSTOR/SEGSSE.c) bridges the internal SegmentStore vtable to an external FSEG SPI provider. It is activated by SEGMENT_STORE_METHOD_USER (CLEP: store.seguser()).

Initialization

segstore_user_new() performs three steps:

1. Resolves the provider library name and function name from CLEP parameters (LIBRARY=, FUNC=), falling back to the FL_FSEG_LIBRARY and FL_FSEG_FUNCTION environment variables. 2. If SAF/RACF is active, authorizes library name, function name, and archive namespace against the FSEGCTL resource class (READ level). 3. Loads the shared library via the DYL module and resolves the entry point symbol (default: FSEGUSR).

Mode-to-Flag Mapping

SEGSSE translates SegStoreMode to FSEG_FLAG_* bits in TsFsegOpn.uiFlg:

 SegStoreMode             FSEG flags set
 -----------------------  ----------------------------------------
 SEGSTORE_READ            (none beyond LOG/DEBUG/ACCESS/STRONG)
 SEGSTORE_CREATE          FSEG_FLAG_WRITE
 SEGSTORE_UPDATE          FSEG_FLAG_WRITE | FSEG_FLAG_OVERWRITE
 SEGSTORE_VERSION_LIST    FSEG_FLAG_VERSIONED
 SEGSTORE_VERSION_DELETE  FSEG_FLAG_VERSIONED | FSEG_FLAG_WRITE

The LOG, DEBUG, TRACE, ACCESS, and STRONG flags are always forwarded from the CLEP parameters to every OPN call regardless of mode.

Stateless Operations in NEW State

For lightweight operations (exists(), prune(), deleteStore()) that arrive before the store has been opened, SEGSSE ensures the provider handle is in NEW state (calling CLS first if currently OPEN), then issues a single NEW-state call:

exists() -> FSEG_FUNC_EXS (siSegInd=0; isExists in result) prune() -> FSEG_FUNC_PRN (uiKeepCnt from config) deleteStore() -> FSEG_FUNC_DAR

The provider must self-manage any temporary storage connection for these calls. If the archive does not exist, the provider should return FSSE_OK with isExists=0 / uiVerDel=0 and not treat it as an error.

Error Translation

Any non-zero return code from the provider is translated to FLMRTC_FSG. The provider message (written into the errMsg buffer) is augmented with the function name and the numeric provider return code before being surfaced via SegmentStore.errorMsg().

Version ID Reporting

After a successful OPN call, SEGSSE reads siOpenedVerId from the TsFsegOpn response and stores it in the handle. This value is returned by getVersionID() so that the archive layer can log the actual version that was opened (useful in read mode).

OBJSSE: FOBJ SPI Bridge

OBJSSE (CSRC/SEGSTOR/OBJSSE.c) bridges the internal ObjectStore vtable to an external FOBJ SPI provider. It is activated by SEGMENT_OBJECTS_METHOD_USER (CLEP: store.objuser()).

Initialization

objstore_user_new() follows the same three-step pattern as SEGSSE:

1. Resolve library and function name (CLEP params or FL_FOBJ_LIBRARY / FL_FOBJ_FUNCTION environment variables). 2. SAF/RACF authorization against the FOBJCTL resource class (READ level) for library name, function name, namespace, and parameter. 3. DYL load + entry point resolution (default: FOBJUSR).

Locate Semantics for GET

OBJSSE implements locate semantics for object retrieval: getObject() calls FOBJ_FUNC_GET and passes the provider's result pointer directly to the caller without copying the data. The returned pointer is valid until the next call to getObject() or to close().

NFD Mapping

When FOBJ_FUNC_GET returns FOBJ_RTC_NFD (object not found), OBJSSE maps this to FLMRTC_NFD. This allows the SEGOBJ layer to distinguish a missing root object (new archive) from a backend I/O error.

No listObjects Bridge

The internal ObjectStore vtable carries an optional listObjects() member, implemented by the folder, S3, Azure and Cloud Data Access backends. It serves two purposes - a test that asserts what a namespace contains, and the store inventory of archive.list(CONTENT=STORE) - and it is deliberately NOT bridged to the FOBJ SPI: there is no FOBJ function code for it, OBJSSE leaves the member NULL, and the segment store itself never calls it on the data path. An external provider therefore neither has to implement a listing nor loses anything by not having one.

Where it is implemented, the entry array and its keys belong to the store and stay valid until the next listObjects() on the same handle or its close(). The completeness flag matters for Cloud Data Access only: that backend paginates internally and answers a repeated request with the same page, so a capped listing is reported rather than continued.

Each entry carries whatever the backend delivers in the response it sends anyway, and a flag word saying which of the fields are valid - a size of zero is a legitimately empty object and must not be read as "size unknown":

 Backend  size            timestamp       ETag   class or tier   mode
 -------  --------------  --------------  -----  --------------  ------
 S3       Size            LastModified    ETag   StorageClass    --
 Azure    Content-Length  Last-Modified   Etag   AccessTier      --
 CDA      --              --              --     --              --
 Folder   stat()          st_mtime        --     --              st_mode

The timestamp is a fixed-width string in UTC, "YYYY-MM-DD HH:MM:SS", and not a numeric time: there is no portable timegm() on z/OS, so each backend re-formats the fields of what it received instead of converting them. Sorting the string lexicographically sorts chronologically.

listStore: the Storage Inventory

The SegmentStore vtable has an optional listStore() member that the object-store implementation answers by delegating to listObjects(). It is the other listing, and a different question from listVersions(): that one answers which versions an archive has, this one answers what is in the storage the archive lives in.

It is usable in NEW state and must not open the archive - the whole point is what exists before anything is opened, so a prefix that holds no archive is a legitimate answer with a count of zero. SEGFILE and SEGSSE leave the member NULL, and the layer above then reports that this storage type cannot be listed, which is not the same statement as an empty storage.

An archive is identified from the key names alone. The segment store makes a version visible with a root object, so a key that ends in the root name marks the prefix in front of it as an archive, and the remaining names (root, index.<n>, object.<a>.<b>.<c>, dstate) say which objects belong to it. The boundary character before the root name is either a slash or a dot: the cloud backends address with slashes, while the folder backend maps a key's dots onto directories, so the same rule reads both.

Error Translation

Any provider return code other than FOBJ_RTC_OK and FOBJ_RTC_NFD is translated to FLMRTC_FOB. The provider message is augmented in the same way as in SEGSSE.

FSSE: Reference Provider (libfsse)

FSSE (CSRC/SEGSTOR/FSSE.c) is the built-in reference implementation of both SPI contracts. It is compiled into a single shared library (libfsse.so on Linux, libfsse.dll on Windows) and ships as part of the FL5 distribution.

Entry Points

 Entry point  SPI    Backed by
 -----------  -----  ------------------------------------------
 FSEGUSR      FSEG   SEGFILE flat-file segment store
 FOBJUSR      FOBJ   OBJFLDR folder-based object store

Both entry points accept the same 8-argument signature defined by TfFsegExit / TfFobjExit. Providers that do not require FLAM internals may ignore the pvGbl (first) argument.

Parameter String

The PARAMETER= string (or FL_FSEG_PARAMETER / FL_FOBJ_PARAMETER) is a semicolon-separated list of key=value pairs:

 Key   Description                          Default
 ----  -----------------------------------  ----------------------------
 path  Base directory for the store.        Current working directory
       FSEGUSR appends /{namespace} to get
       the flat-file archive path.
       FOBJUSR appends /{namespace} to get
       the OBJFLDR base folder path.

Example CLEP activation:

 store.seguser(LIBRARY='libfsse',
               FUNC='FSEGUSR',
               PARAMETER='path=/var/flam/stores')

 store.objuser(LIBRARY='libfsse',
               FUNC='FOBJUSR',
               PARAMETER='path=/var/flam/stores')

Stateless Operation Support

FSEGUSR implements FSEG_FUNC_EXS, FSEG_FUNC_DAR, and FSEG_FUNC_PRN in NEW state: the provider internally opens the SEGFILE backend, executes the operation, and closes before returning. FOBJUSR implements FOBJ_FUNC_EXS and FOBJ_FUNC_DST in NEW state using the same pattern with OBJFLDR. This eliminates the need for the bridge to perform probe OPN+op+CLS sequences.

Provider Return Codes

FSSE uses private return codes (not FLMRTC_* values):

 Constant      Value  Meaning
 ------------  -----  ------------------------------------------
 FSSE_OK         0    Success
 FSSE_ERR_ITF    1    Bad parameters or unknown function code
 FSSE_ERR_ALC    2    Memory allocation failure
 FSSE_ERR_STO    3    SEGFILE or OBJFLDR backend error

FSSE_ERR_ITF is returned when the provider receives a piVersion pointer whose dereferenced major version (high byte) does not match the compiled-in FSEG or FOBJ major version. This implements SPI interface version gating: a provider built against FSEG 0x0200 rejects a caller that passes *piVersion == 0x0100, preventing silent ABI mismatches.

FSSE_ERR_NFD is not a separate code. When OBJFLDR signals FLMRTC_NFD for a missing object, fsse_obj_get() translates this to FOBJ_RTC_NFD before returning so that OBJSSE and SEGOBJ can correctly detect a missing root object during archive open.

Removing a Namespace

An archive is removed with archive.delarc(), which reads the access rights out of the archive's MAIN segment and honours DELARC in them. That is the normal way and the only one that is subject to those rights.

It cannot reach objects that belong to no archive any more. A write that is interrupted before its root object is written leaves container and index objects under the prefix with no root to find them by; delarc opens the archive first and answers "object not found", so the objects stay -- in a bucket that is billed.

For that case flcl offers 'util run.delsto', which asks the storage to drop every object below the prefix without opening anything. It reads no MAIN segment, therefore it cannot honour the DELARC right, and it is governed by the SAF resource RST.DELSTO with access level CONTROL instead. PREFIX is required for the object stores that have one, and it answers rc 0 on a namespace that is already empty. See the description of the DELSTO function of the UTIL command.