MCPcopy Create free account
hub / github.com/astercloud/aster / Write

Method Write

pkg/backends/filesystem.go:98–110  ·  view source on GitHub ↗

Write 实现 BackendProtocol.Write

(ctx context.Context, path, content string)

Source from the content-addressed store, hash-verified

96
97// Write 实现 BackendProtocol.Write
98func (b *FilesystemBackend) Write(ctx context.Context, path, content string) (*WriteResult, error) {
99 // 使用 SandboxFS 写入文件
100 if err := b.fs.Write(ctx, path, content); err != nil {
101 return nil, err
102 }
103
104 return &WriteResult{
105 Error: "", // 空字符串表示成功
106 Path: path,
107 BytesWritten: int64(len(content)),
108 FilesUpdate: nil, // FilesystemBackend 不需要返回状态更新
109 }, nil
110}
111
112// Edit 实现 BackendProtocol.Edit
113func (b *FilesystemBackend) Edit(ctx context.Context, path, oldStr, newStr string, replaceAll bool) (*EditResult, error) {

Callers

nothing calls this directly

Calls 1

WriteMethod · 0.65

Tested by

no test coverage detected