开发检查点:完成可信恢复证据与部署回归
补充部署事务恢复证据、锁归属和文件摘要校验,接入站点恢复基线,更新三数据库迁移与回归测试。
This commit is contained in:
1 parent
fb8ddd5002
commit
0e48dc9231
13 files changed
+508
-97
No files matched your search
@@ -63,10 +63,35 @@ func (c *memoryClient) Lock(_ context.Context, path string) error {
|
||||
}
|
||||
|
||||
func (c *memoryClient) Unlock(_ context.Context, path string) error {
|
||||
delete(c.files, path+"/owner")
|
||||
delete(c.files, path)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *memoryClient) CreateOwnedLock(_ context.Context, path, token string) error {
|
||||
if _, exists := c.files[path]; !exists {
|
||||
return errors.New("模拟锁不存在")
|
||||
}
|
||||
c.files[path+"/owner"] = memoryFile{data: []byte(token), mode: 0o600}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (c *memoryClient) ReadLockOwner(_ context.Context, path string) (string, error) {
|
||||
file, ok := c.files[path+"/owner"]
|
||||
if !ok {
|
||||
return "", nil
|
||||
}
|
||||
return string(file.data), nil
|
||||
}
|
||||
|
||||
func (c *memoryClient) FileDigest(_ context.Context, path string) (string, error) {
|
||||
file, ok := c.files[path]
|
||||
if !ok {
|
||||
return "", errors.New("模拟文件不存在")
|
||||
}
|
||||
return contentDigest(file.data), nil
|
||||
}
|
||||
|
||||
func (c *memoryClient) Exists(_ context.Context, path string) (bool, error) {
|
||||
_, ok := c.files[path]
|
||||
return ok, nil
|
||||
|
||||
Reference in new issue
Block a user