Skip to content

Commit

Permalink
wip opts parsing only, no implem change
Browse files Browse the repository at this point in the history
  • Loading branch information
JulienVdG committed Jan 23, 2023
1 parent f836b75 commit c5cfb87
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions server/opts.go
Expand Up @@ -1127,6 +1127,8 @@ func (o *Options) processConfigFileLine(k string, v interface{}, errors *[]error
}
case map[string]interface{}:
del := false
hdel := false
hdel_set := false
dir := ""
dirType := ""
limit := int64(0)
Expand All @@ -1146,6 +1148,11 @@ func (o *Options) processConfigFileLine(k string, v interface{}, errors *[]error
_, v := unwrapValue(v, &lt)
del = v.(bool)
}
if v, ok := v["hard_delete"]; ok {
_, v := unwrapValue(v, &lt)
hdel_set = true
hdel = v.(bool)
}
if v, ok := v["limit"]; ok {
_, v := unwrapValue(v, &lt)
limit = v.(int64)
Expand Down Expand Up @@ -1186,11 +1193,26 @@ func (o *Options) processConfigFileLine(k string, v interface{}, errors *[]error
if del {
*errors = append(*errors, &configErr{tk, "CACHE does not accept allow_delete"})
}
if hdel_set {
*errors = append(*errors, &configErr{tk, "CACHE does not accept hard_delete"})
}
res, err = NewCacheDirAccResolver(dir, limit, ttl, opts...)
case "FULL":
if ttl != 0 {
*errors = append(*errors, &configErr{tk, "FULL does not accept ttl"})
}
if hdel_set && !del {
*errors = append(*errors, &configErr{tk, "hard_delete has no effect without delete"})
}
deleteType := NoDelete
if del {
if hdel {
deleteType = HardDelete
} else {
deleteType = RenameDeleted
}
}
_ = deleteType // fake use
res, err = NewDirAccResolver(dir, limit, sync, del, opts...)
}
if err != nil {
Expand Down

0 comments on commit c5cfb87

Please sign in to comment.