lib/protocol: Further interface refactor (#9396)
This is a symmetric change to #9375 -- where that PR changed the protocol->model interface, this changes the model->protocol one.
This commit is contained in:
+11
-11
@@ -13,23 +13,23 @@ type wireFormatConnection struct {
|
||||
Connection
|
||||
}
|
||||
|
||||
func (c wireFormatConnection) Index(ctx context.Context, folder string, fs []FileInfo) error {
|
||||
for i := range fs {
|
||||
fs[i].Name = norm.NFC.String(filepath.ToSlash(fs[i].Name))
|
||||
func (c wireFormatConnection) Index(ctx context.Context, idx *Index) error {
|
||||
for i := range idx.Files {
|
||||
idx.Files[i].Name = norm.NFC.String(filepath.ToSlash(idx.Files[i].Name))
|
||||
}
|
||||
|
||||
return c.Connection.Index(ctx, folder, fs)
|
||||
return c.Connection.Index(ctx, idx)
|
||||
}
|
||||
|
||||
func (c wireFormatConnection) IndexUpdate(ctx context.Context, folder string, fs []FileInfo) error {
|
||||
for i := range fs {
|
||||
fs[i].Name = norm.NFC.String(filepath.ToSlash(fs[i].Name))
|
||||
func (c wireFormatConnection) IndexUpdate(ctx context.Context, idxUp *IndexUpdate) error {
|
||||
for i := range idxUp.Files {
|
||||
idxUp.Files[i].Name = norm.NFC.String(filepath.ToSlash(idxUp.Files[i].Name))
|
||||
}
|
||||
|
||||
return c.Connection.IndexUpdate(ctx, folder, fs)
|
||||
return c.Connection.IndexUpdate(ctx, idxUp)
|
||||
}
|
||||
|
||||
func (c wireFormatConnection) Request(ctx context.Context, folder string, name string, blockNo int, offset int64, size int, hash []byte, weakHash uint32, fromTemporary bool) ([]byte, error) {
|
||||
name = norm.NFC.String(filepath.ToSlash(name))
|
||||
return c.Connection.Request(ctx, folder, name, blockNo, offset, size, hash, weakHash, fromTemporary)
|
||||
func (c wireFormatConnection) Request(ctx context.Context, req *Request) ([]byte, error) {
|
||||
req.Name = norm.NFC.String(filepath.ToSlash(req.Name))
|
||||
return c.Connection.Request(ctx, req)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user