Documentation
¶
Overview ¶
Package extensionstorage applies declarative mutations to persistent Chromium extension storage.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
func Apply(ctx context.Context, options ApplyOptions) error
Apply validates, plans, and commits extension-storage settings in source order. It edits Chromium's LevelDB ValueStore representation directly, so the browser must be closed. Direct writes do not emit chrome.storage change events. Sync-area writes update the local cache only; when cloud sync already has state, Chromium's startup merge treats that state as authoritative and may overwrite these bytes. Source: https://chromium.googlesource.com/chromium/src/+/879b13b2715914eb6263fbbfa1eae7e1d49f9c1c/chrome/browser/extensions/api/storage/syncable_settings_storage.cc#148
func IsTemporarilyUnavailable ¶
IsTemporarilyUnavailable reports whether Chromium storage should be retried after the browser releases its LevelDB files.
func ValidateFiles ¶
ValidateFiles validates extension-storage settings without writing a profile.
Types ¶
type ApplyOptions ¶
type ApplyOptions struct {
ProfileDir string
Settings []string
SettingsSource []SettingsSource
ExtensionIDAliases map[string]string
Input Input
}
ApplyOptions controls one extension-storage application run.
type Area ¶
type Area string
Area selects a persistent chrome.storage area. Only the disk-backed local and sync areas are supported; managed storage is policy-owned and session storage exists only in browser memory. Source: https://chromium.googlesource.com/chromium/src/+/879b13b2715914eb6263fbbfa1eae7e1d49f9c1c/extensions/browser/api/storage/value_store_util.cc#17
type Encoding ¶
type Encoding string
Encoding describes the bytes stored as one LevelDB value. EncodingJSON is Chromium's native ValueStore representation: a chrome.storage key maps to one JSON-serialized value. EncodingLZStringURI is an extension-owned convention: Chromium sees a JSON string while the extension decompresses that string into another JSON document. Native JSON source: https://chromium.googlesource.com/chromium/src/+/879b13b2715914eb6263fbbfa1eae7e1d49f9c1c/components/value_store/leveldb_value_store.cc#268
type InputBinding ¶
type InputBinding struct {
Name string `json:"name"`
Area Area `json:"area"`
ID string `json:"id"`
Key string `json:"key"`
Path string `json:"path,omitempty"`
Encoding Encoding `json:"encoding,omitempty"`
Operation OperationKind `json:"operation,omitempty"`
}
InputBinding maps a named runtime value to an extension storage target.
type Operation ¶
type Operation struct {
ID string `json:"id"`
Area Area `json:"area"`
Key string `json:"key,omitempty"`
Operation OperationKind `json:"operation,omitempty"`
Path string `json:"path,omitempty"`
Encoding Encoding `json:"encoding,omitempty"`
Value jsontext.Value `json:"value,omitzero"`
}
Operation describes one direct storage mutation.
type OperationKind ¶
type OperationKind string
OperationKind identifies a mutation applied to a storage value.
const ( OperationSet OperationKind = "set" OperationMerge OperationKind = "merge" OperationAppend OperationKind = "append" OperationRemove OperationKind = "remove" OperationClear OperationKind = "clear" )
type Settings ¶
type Settings struct {
Schema string `json:"$schema,omitempty"`
SchemaVersion int `json:"schema_version,omitzero"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
Local []Entry `json:"local,omitempty"`
Sync []Entry `json:"sync,omitempty"`
LocalAppend []Entry `json:"local_append,omitempty"`
SyncAppend []Entry `json:"sync_append,omitempty"`
Operations []Operation `json:"operations,omitempty"`
Inputs []InputBinding `json:"inputs,omitempty"`
}
Settings is the public JSON document accepted by extension_settings.files and --settings. The legacy local/sync fields remain useful for bulk top-level writes, while Operations supports precise mutation of JSON documents stored beneath individual chrome.storage keys.
type SettingsSource ¶
SettingsSource is an in-memory settings document with a diagnostic name.