store

package
v1.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package store は、MangaState(状態ドキュメント)の永続化を提供します。 state は GCS またはローカルの comic_state.json として保存され、これが作品の 唯一の真実源になります。履歴一覧はアプリ側がこのファイル群を列挙して実現します。

入出力には encoding/json/v2 を使います。v1 と違って重複したメンバー名を既定で 拒否するためで、唯一の真実源のロード口としては「壊れた state を黙って後勝ちで 読む」より「壊れていると言う」ほうが正しいからです。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

func Load(ctx context.Context, reader ports.ContentReader, statePath string) (*comic.MangaState, error)

Load は指定パス(GCS URI またはローカルパス)から MangaState を読み込みます。

失敗は ports の番兵エラーで分類して返します。state が「まだ無い」のか「壊れている」のか 「読めなかった」のかは呼び出し側の応答(404 / 400 / 502)が変わるところなので、 メッセージではなく errors.Is で見分けられる必要があります。

func Save

func Save(ctx context.Context, writer remoteio.Writer, state *comic.MangaState, outputDir string) (string, error)

Save は MangaState を outputDir 配下の comic_state.json として保存し、保存先パスを返します。 同名ファイルは上書きされます(state は唯一の真実源であり、常に最新を保持します)。

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL