Skip to content

Commit

Permalink
feat: add name to storage.json
Browse files Browse the repository at this point in the history
  • Loading branch information
LinZexiao committed Jul 28, 2023
1 parent 9f643b7 commit abd91a9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
9 changes: 7 additions & 2 deletions damocles-manager/modules/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ type StoragePathConfig struct {
}

type LocalPath struct {
Name string
Path string
}

Expand Down Expand Up @@ -288,7 +289,7 @@ func (c CommonConfig) GetPersistStores() []PersistStoreConfig {
log.Errorf("decode storage config file %s failed: %s", p, err)
} else {
for _, lp := range cfg.StoragePaths {
ret = append(ret, PersistStoreConfig{
psc := PersistStoreConfig{
Config: objstore.Config{
Path: lp.Path,
Meta: preset.Meta,
Expand All @@ -300,7 +301,11 @@ func (c CommonConfig) GetPersistStores() []PersistStoreConfig {
AllowMiners: preset.AllowMiners,
DenyMiners: preset.DenyMiners,
},
})
}
if lp.Name != "" {
psc.Name = lp.Name
}
ret = append(ret, psc)
}
log.Infof("load storage config file %s success", p)
}
Expand Down
17 changes: 16 additions & 1 deletion docs/zh/04.damocles-manager的配置解析.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Path = "/mnt/mass/piece1"
#### 基础配置范例

```toml
[[Common.PersistStores]]
[Common.PieceStorePreset]

# 只读,选填项,布尔类型
# 默认值为 false
Expand Down Expand Up @@ -302,6 +302,21 @@ StorageConfigPath = "/optional/path/to/your/storage.json"
#
```

- storage.json

```json
{
"StoragePaths": [
{
"Name": "persist",
"Path": "/root/persist"
}
]
}
```

其中 `Name` 属性可以省略,省略时默认使用 `Path` 属性的值作为 `Name`

### [[Common.PersistStores]]

`Common.PersistStores` 用于配置扇区持久化数据存储。与之对应的是 `damocles-worker` 中的 `attached` 概念。
Expand Down

0 comments on commit abd91a9

Please sign in to comment.