Table of Contents

Class BaseJournalBackend

Namespace
OptunaSharp.Storages.Journal
Assembly
OptunaSharp.dll

Base class for Journal storages. Port of optuna/storages/journal/_base.py: BaseJournalBackend.

Storage classes implementing this base class must guarantee process safety. This means, multiple processes might concurrently call ReadLogs(int) and AppendLogs(IReadOnlyList<OrderedDict<string, object?>>). If the backend storage does not internally support mutual exclusion mechanisms, such as locks, you might want to use JournalFileSymlinkLock or JournalFileOpenLock for creating a critical section.

public abstract class BaseJournalBackend
Inheritance
BaseJournalBackend
Derived
Inherited Members

Methods

AppendLogs(IReadOnlyList<OrderedDict<string, object?>>)

Append logs to the backend.

public abstract void AppendLogs(IReadOnlyList<OrderedDict<string, object?>> logs)

Parameters

logs IReadOnlyList<OrderedDict<string, object>>

A list that contains json-serializable logs.

Exceptions

Exception

The backend cannot serialize or durably append the records.

ReadLogs(int)

Read logs with a log number greater than or equal to logNumberFrom. If logNumberFrom is 0, read all the logs.

public abstract IEnumerable<OrderedDict<string, object?>> ReadLogs(int logNumberFrom)

Parameters

logNumberFrom int

Zero-based inclusive log-record number; zero reads the complete journal.

Returns

IEnumerable<OrderedDict<string, object>>

A sequence of decoded records in append order, starting at the requested record number.

Exceptions

Exception

The journal backend cannot read or decode its records; lazy backends can fail during enumeration.