API
الطرق المذكورة هنا هي واجهة API الموثقة لإصدارات 0.5. تكشف بعض الأصناف عن طرق عامة إضافية كي تتعاون محركات storh داخليًا؛ تعامل معها كتفاصيل تنفيذية ما لم تُذكر في هذه الصفحة.
StorageRoot
StorageRoot::at(string $root): StorageRootStorageRoot::resolve(string $root, string $namespace = 'runtime-storage'): stringpath(string $namespace = 'runtime-storage'): stringroot(): string
DocStore
اسم مستعار لـ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
اسم مستعار لـ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
اسم مستعار لـ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
يتطلب ext-pdo (مشغّل sqlite أو mysql) أو 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
طبّق هذه الواجهة (وSqlMirrorStatement) لتشغيل SqlMirror
عبر طبقة قاعدة بيانات مخصصة. PdoSqlMirrorConnection وMysqliSqlMirrorConnection هما
التطبيقان المضمّنان.
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