|
|
|
@ -9,21 +9,19 @@ import ( |
|
|
|
|
type Listener func(status SpaceStatus) |
|
|
|
|
|
|
|
|
|
type Storage struct { |
|
|
|
|
filePath string |
|
|
|
|
persistent bool |
|
|
|
|
status SpaceStatus |
|
|
|
|
filePath string |
|
|
|
|
status SpaceStatus |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func Open(filePath string, persistent bool) (*Storage, error) { |
|
|
|
|
func Open(filePath string) (*Storage, error) { |
|
|
|
|
status, err := readFile(filePath) |
|
|
|
|
if err != nil { |
|
|
|
|
return nil, fmt.Errorf("error reading status: %s", err) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return &Storage{ |
|
|
|
|
filePath: filePath, |
|
|
|
|
persistent: persistent, |
|
|
|
|
status: *status, |
|
|
|
|
filePath: filePath, |
|
|
|
|
status: *status, |
|
|
|
|
}, nil |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|