Bedrock.DataPlane.Log.Shale.SegmentRecycler (bedrock v0.7.0)

View Source

Manages segment file allocation and recycling for the Shale log.

Summary

Functions

Return a segment to the recycler. The recycler will delete the segment if it is already holding max_available of them.

Ask the recycler for a fresh segment. The recycler will return one of the segments that it has on-hand, and will attempt to allocate a new one if necessary.

Types

server()

@type server() :: GenServer.server()

Functions

check_in(segment_recycler, segment)

@spec check_in(server(), path :: String.t()) :: :ok | {:error, File.posix()}

Return a segment to the recycler. The recycler will delete the segment if it is already holding max_available of them.

Returns the unlink's error if that deletion fails; callers that match on :ok will crash the log and re-recover, which is the same exposure the rename this replaced always had.

check_out(segment_recycler, new_path)

@spec check_out(server(), new_path :: String.t()) :: :ok | {:error, term()}

Ask the recycler for a fresh segment. The recycler will return one of the segments that it has on-hand, and will attempt to allocate a new one if necessary.

child_spec(args)

@spec child_spec(term()) :: Supervisor.child_spec()