refactor: storage namings
This commit is contained in:
+16
-14
@@ -13,40 +13,42 @@ type Storage interface {
|
||||
WriteFile(string, []byte) error
|
||||
DeleteFile(string) error
|
||||
ListFiles() ([]string, error)
|
||||
|
||||
// StateExistss() (bool, error)
|
||||
}
|
||||
|
||||
// UIStorage manages Client's data local storing and retrieval.
|
||||
// It performs all I/O operations asynchronously to avoid UI main thread blocking.
|
||||
type UIStorage interface {
|
||||
// StateExists check asynchronously for previously saved [model.State] exists on the filesystem.
|
||||
// StateExistsAsync check asynchronously for previously saved [model.State] exists on the filesystem.
|
||||
// Passed callback func will will accept false and non-nil error in case of I/O or decoding errors occuried,
|
||||
// otherwise bool parameter will indicate existence of previously stores state
|
||||
StateExists(func(bool, error))
|
||||
StateExistsAsync(func(bool, error))
|
||||
|
||||
// LoadState loads Client's [model.State] from filesystem data asynchronously.
|
||||
// LoadStateAsync loads Client's [model.State] from filesystem data asynchronously.
|
||||
// Passed callback func will accept non-nil error in case of I/O or decoding errors occuried,
|
||||
// otherwise callback func accepts loaded [model.State].
|
||||
LoadState(func(client.State, error))
|
||||
LoadStateAsync(func(client.State, error))
|
||||
|
||||
// SaveState stores Client's state at the filesystem asynchronously.
|
||||
// SaveStateAsync stores Client's state at the filesystem asynchronously.
|
||||
// I/O or encoding error may occur, it that case callback func will be called with non-nil error.
|
||||
SaveState(client.State, func(error))
|
||||
SaveStateAsync(client.State, func(error))
|
||||
|
||||
// LoadReport loads a [report.Report] for a given [model.GameID] and turn number from filesystem asynchronously.
|
||||
// LoadReportAsync loads a [report.Report] for a given [model.GameID] and turn number from filesystem asynchronously.
|
||||
// Passed callback func will will accept non-nil error in case of I/O or decoding errors occuried,
|
||||
// otherwise callback func accepts loaded [report.Report].
|
||||
LoadReport(client.GameID, uint, func(report.Report, error))
|
||||
LoadReportAsync(client.GameID, uint, func(report.Report, error))
|
||||
|
||||
// SaveReport stores given [report.Report] for a given [model.GameID] and turn number at the filesystem asynchronously.
|
||||
// SaveReportAsync stores given [report.Report] for a given [model.GameID] and turn number at the filesystem asynchronously.
|
||||
// I/O or encoding error may occur, it that case callback func will be called with non-nil error.
|
||||
SaveReport(client.GameID, uint, report.Report, func(error))
|
||||
SaveReportAsync(client.GameID, uint, report.Report, func(error))
|
||||
|
||||
// LoadOrder loads a [order.Order] for a given [model.GameID] and turn number from filesystem asynchronously.
|
||||
// LoadOrderAsync loads a [order.Order] for a given [model.GameID] and turn number from filesystem asynchronously.
|
||||
// Passed callback func will will accept non-nil error in case of I/O or decoding errors occuried,
|
||||
// otherwise callback func accepts loaded [order.Order].
|
||||
LoadOrder(client.GameID, uint, func(order.Order, error))
|
||||
LoadOrderAsync(client.GameID, uint, func(order.Order, error))
|
||||
|
||||
// SaveOrder stores given [order.Order] for a given [model.GameID] and turn number at the filesystem asynchronously.
|
||||
// SaveOrderAsync stores given [order.Order] for a given [model.GameID] and turn number at the filesystem asynchronously.
|
||||
// I/O or encoding error may occur, it that case callback func will be called with non-nil error.
|
||||
SaveOrder(client.GameID, uint, order.Order, func(error))
|
||||
SaveOrderAsync(client.GameID, uint, order.Order, func(error))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user