Archived
This adds a thin type that holds the state associated with the leveldb.DB, leaving the huge Instance type more or less stateless. Also moves some keying stuff into the DB package so that other packages need not know the keying specifics. (This does not, yet, fix the cmd/stindex program, in order to keep the diff size down. Hence the keying constants are still exported.)
This commit is contained in:
1 parent
8e645ab782
commit
b50d57b7fd
22 files changed
+382
-374
No files matched your search
+2
-3
@@ -21,10 +21,9 @@ type DeviceStatisticsReference struct {
|
||||
device string
|
||||
}
|
||||
|
||||
func NewDeviceStatisticsReference(ldb *db.Instance, device string) *DeviceStatisticsReference {
|
||||
prefix := string(db.KeyTypeDeviceStatistic) + device
|
||||
func NewDeviceStatisticsReference(ldb *db.Lowlevel, device string) *DeviceStatisticsReference {
|
||||
return &DeviceStatisticsReference{
|
||||
ns: db.NewNamespacedKV(ldb, prefix),
|
||||
ns: db.NewDeviceStatisticsNamespace(ldb, device),
|
||||
device: device,
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -28,10 +28,9 @@ type LastFile struct {
|
||||
Deleted bool `json:"deleted"`
|
||||
}
|
||||
|
||||
func NewFolderStatisticsReference(ldb *db.Instance, folder string) *FolderStatisticsReference {
|
||||
prefix := string(db.KeyTypeFolderStatistic) + folder
|
||||
func NewFolderStatisticsReference(ldb *db.Lowlevel, folder string) *FolderStatisticsReference {
|
||||
return &FolderStatisticsReference{
|
||||
ns: db.NewNamespacedKV(ldb, prefix),
|
||||
ns: db.NewFolderStatisticsNamespace(ldb, folder),
|
||||
folder: folder,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user