API
The methods listed here are the documented 0.5.0 API. Some classes expose additional public methods so storh engines can cooperate internally; treat those as implementation details unless they are listed on this page.
StorageRoot
StorageRoot::at(string $root): StorageRootStorageRoot::resolve(string $root, string $namespace = 'runtime-storage'): stringpath(string $namespace = 'runtime-storage'): stringroot(): string
DocStore
Alias of DocPerFileStore.
put(array $data, ?string $id = null): StorageRecordputMany(iterable $records): arrayputStream(iterable $records): intget(string $id): ?StorageRecorddelete(string $id): voidstream(?RecordQuery $query = null): Generatorquery(): QueryBuilderindexes(): DocStoreIndexManagerreindex(): arraystats(): arrayhealth(): arrayverify(): arrayrepair(): arraycompact(): arrayimportJsonl(string $path): intexportJsonl(string $path): intpath_for_id(string $id): string
SegmentedLog
Alias of SegmentedLogStore.
put(array $data, ?string $id = null): StorageRecordappendMany(iterable $records): arrayappendStream(iterable $records): intget(string $id): ?StorageRecorddelete(string $id): voidstream(?RecordQuery $query = null): Generatorquery(): QueryBuilderretain(): SegmentedLogRetentioncompact(): voidrecover(): voidstate_index(): arraystats(): arrayhealth(): arrayverify(): arrayrepair(): array
Queue
Alias of LogQueue.
enqueue(array $payload, ?string $id = null): stringenqueueMany(iterable $jobs): arrayclaim(): ?StorageRecordclaimMany(int $limit): arraycomplete(string $id, bool $keep_done = true): voidcompleteMany(iterable $ids, bool $keep_done = true): intrequeue_timed_out(int $timeout_seconds): intpurgeDone(int $olderThanSeconds = 0): intcounts(): arraystats(): arrayhealth(): arrayverify(): arrayrepair(int $processingTimeoutSeconds = 3600): array
QueryBuilder
where(string $field): QueryFieldBuilderandWhere(callable $callback): QueryBuilderorWhere(callable $callback): QueryBuilderorderBy(string $field, string $direction = 'asc'): QueryBuilderlimit(int $limit): QueryBuildercursor(string $id): QueryBuilderpage(int $size): QueryBuilderget(): arrayfirst(): ?StorageRecordcount(): intexplain(): array
DocStoreIndexManager
field(string $field): DocStoreIndexFieldBuilderdefine_field(string $field, bool $unique = false, bool $range = false): DocStoreIndexManagerapply_schema(Schema $schema): DocStoreIndexManagersync(bool $rebuild = true): voidrebuild(): arraydefinitions(): array
Schema
Schema::collection(string $collection): Schemastring(string $field): SchemaFieldBuilderint(string $field): SchemaFieldBuilderfloat(string $field): SchemaFieldBuilderbool(string $field): SchemaFieldBuildermixed(string $field): SchemaFieldBuilderrequired(array $fields): Schemavalidate(array $data): void
Cache
Cache::memory(int $maxEntries = 10000, ?int $maxBytes = null): CacheInterfaceCache::apcu(string $prefix = 'storh'): CacheInterfaceCache::null(): CacheInterface
CacheValidation
CacheValidation::HASHCacheValidation::STATCacheValidation::TRUST
SqlMirror
Requires ext-pdo (sqlite or mysql driver) or ext-mysqli.
new SqlMirror(PDO|mysqli|SqlMirrorConnection $connection, string $prefix = 'storh_', ?string $driver = null)collection(FileStoreInterface $store, string $name, ?Schema $schema = null): SqlMirrorinstall(): voiduninstall(): voidpush(?string $name = null): arrayflush(string $name, array $ids): arraypull(?string $name = null): arrayverify(): arrayrebuild(?string $name = null): arraytable(string $name): string
SqlMirrorConnection
Implement this interface (and SqlMirrorStatement) to drive SqlMirror
through a custom database layer. PdoSqlMirrorConnection and
MysqliSqlMirrorConnection are the bundled implementations.
driver(): stringexecute(string $sql): voidrows(string $sql): Generatorstatement(string $sql): SqlMirrorStatementbegin(): voidcommit(): voidrollback(): voidin_transaction(): bool
RecordQuery
RecordQuery::all(): RecordQueryafter(string $id): RecordQuerytime_range_ms(?int $from_ms, ?int $until_ms): RecordQuerywhere_equal(string $field, mixed $value): RecordQuerylimit(int $limit): RecordQuerycontinue_on_error(callable $handler): RecordQueryon_segment_open(callable $handler): RecordQuery
StorageRecord
id(): stringdata(): array