Documentation
¶
Overview ¶
Package storage はOriginごとのWeb Storage data modelを提供する。
Index ¶
- Constants
- Variables
- func DefaultDataRoot() (string, error)
- func ValidateKey(key string) error
- type Area
- func (area *Area) Clear() error
- func (area *Area) ClearFrom(source MutationSource) error
- func (area *Area) Entries() []Entry
- func (area *Area) Error() error
- func (area *Area) Get(key string) (string, bool)
- func (area *Area) Key(index int) (string, bool)
- func (area *Area) Len() int
- func (area *Area) Remove(key string) error
- func (area *Area) RemoveFrom(source MutationSource, key string) error
- func (area *Area) Set(key, value string) error
- func (area *Area) SetFrom(source MutationSource, key, value string) error
- func (area *Area) Subscribe(sourceID uint64, notify func(Change)) func()
- type Change
- type Entry
- type Manager
- type MutationSource
Constants ¶
const ( MaxKeyBytes = 4 * 1024 MaxValueBytes = 1024 * 1024 MaxOriginStorageBytes = 5 * 1024 * 1024 MaxProfileStorageBytes = 50 * 1024 * 1024 MaxStorageOrigins = 128 )
Variables ¶
var ( ErrQuotaExceeded = errors.New("storage quota exceeded") ErrInvalidString = errors.New("invalid storage string") )
var ( ErrSchemaMismatch = errors.New("storage schema mismatch") ErrCorruptData = errors.New("corrupt storage data") ErrStorageIO = errors.New("storage I/O failure") )
var ErrInvalidOrigin = errors.New("invalid storage origin")
Functions ¶
func DefaultDataRoot ¶
DefaultDataRoot はOS標準のUser Config Directory配下にGrowse data rootを返す。
func ValidateKey ¶
ValidateKey はWeb Storage keyのUTF-8とsize上限を検証する。
Types ¶
type Area ¶
type Area struct {
// contains filtered or unexported fields
}
Area は挿入順を保持する1つのStorage namespaceである。
func NewFailedArea ¶
NewFailedArea は初期化Errorを各操作から返す利用不能なAreaを生成する。
func (*Area) ClearFrom ¶ added in v0.10.0
func (area *Area) ClearFrom(source MutationSource) error
ClearFrom removes every key and notifies other pages after commit.
func (*Area) Entries ¶ added in v0.14.0
Entries returns a defensive insertion-ordered snapshot for persistence and isolated runtime synchronization.
func (*Area) RemoveFrom ¶ added in v0.10.0
func (area *Area) RemoveFrom(source MutationSource, key string) error
RemoveFrom deletes a key and notifies other pages after commit.
type Change ¶ added in v0.10.0
type Change struct {
Key string
OldValue string
NewValue string
HasOldValue bool
HasNewValue bool
Cleared bool
SourceURL string
Sequence uint64
}
Change describes one successfully committed Storage mutation.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager は1つのBrowser Windowに属するLocal / Session Storageを保持する。
func NewPersistentManager ¶
NewPersistentManager はdataRoot配下へLocal Storageを永続化するManagerを生成する。
func (*Manager) DiscardSession ¶ added in v0.10.0
func (manager *Manager) DiscardSession()
DiscardSession destroys this top-level tab's Session Storage namespaces without affecting Local Storage shared by the browser profile.
func (*Manager) NewPageSession ¶ added in v0.10.0
NewPageSession shares Local Storage while creating an empty Session Storage namespace for one top-level tab.
type MutationSource ¶ added in v0.10.0
MutationSource identifies the page that changed a Local Storage Area.