Skip to content

Commit 0fb73ff

Browse files
committed
ipfs: all - normalize op strings
The Go standard library seems to use a normalized name format of lowercase, non-annotated operation names. We'll mimic this, especially since type names could change and break these prefixes (as can be seen in `pinDirectory.Close`).
1 parent e6a004f commit 0fb73ff

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

internal/filesystem/ipfs/ipfs.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ func (fsys *IPFS) Close() error {
168168
}
169169

170170
func (fsys *IPFS) Stat(name string) (fs.FileInfo, error) {
171-
const op = "IPFS.Stat"
171+
const op = "stat"
172172
if name == filesystem.Root {
173173
return &fsys.info, nil
174174
}
@@ -463,12 +463,12 @@ func (fsys *IPFS) openFile(cid cid.Cid, info *nodeInfo) (fs.File, error) {
463463
func (id *ipfsDirectory) Stat() (fs.FileInfo, error) { return id.info, nil }
464464

465465
func (id *ipfsDirectory) Read([]byte) (int, error) {
466-
const op = "ipfsDirectory.Read"
466+
const op = "read"
467467
return -1, fserrors.New(op, id.info.name, filesystem.ErrIsDir, fserrors.IsDir)
468468
}
469469

470470
func (id *ipfsDirectory) StreamDir() <-chan filesystem.StreamDirEntry {
471-
const op = "ipfsDirectory.StreamDir"
471+
const op = "streamdir"
472472
stream := id.stream
473473
if stream == nil {
474474
errs := make(chan filesystem.StreamDirEntry, 1)
@@ -483,7 +483,7 @@ func (id *ipfsDirectory) StreamDir() <-chan filesystem.StreamDirEntry {
483483
}
484484

485485
func (id *ipfsDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
486-
const op = "ipfsDirectory.ReadDir"
486+
const op = "readdir"
487487
if err := id.err; err != nil {
488488
return nil, err
489489
}
@@ -506,7 +506,7 @@ func (id *ipfsDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
506506
}
507507

508508
func (id *ipfsDirectory) Close() error {
509-
const op = "ipfsDirectory.Close"
509+
const op = "close"
510510
if stream := id.stream; stream != nil {
511511
stream.CancelFunc()
512512
id.stream = nil

internal/filesystem/ipfs/keyfs.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ func (kfs *KeyFS) openRoot() (fs.ReadDirFile, error) {
172172
}
173173

174174
func (*keyDirectory) Read([]byte) (int, error) {
175-
const op = "keyDirectory.Read"
175+
const op = "read"
176176
return -1, fserrors.New(op, filesystem.Root, filesystem.ErrIsDir, fserrors.IsDir)
177177
}
178178

@@ -186,7 +186,7 @@ func (kd *keyDirectory) IsDir() bool { return kd.Mode().IsDir() }
186186
func (kd *keyDirectory) Sys() any { return kd }
187187

188188
func (kd *keyDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
189-
const op = "keyDirectory.ReadDir"
189+
const op = "readdir"
190190
if err := kd.err; err != nil {
191191
return nil, err
192192
}
@@ -210,7 +210,7 @@ func (kd *keyDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
210210
}
211211

212212
func (kd *keyDirectory) Close() error {
213-
const op = "keyDirectory.Close"
213+
const op = "close"
214214
if stream := kd.stream; stream != nil {
215215
stream.CancelFunc()
216216
kd.stream = nil

internal/filesystem/ipfs/pinfs.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,12 @@ func (pi *pinDirectoryInfo) Sys() any { return pi }
272272

273273
func (pd *pinDirectory) Stat() (fs.FileInfo, error) { return &pd.info, nil }
274274
func (*pinDirectory) Read([]byte) (int, error) {
275-
const op = "pinDirectory.Read"
275+
const op = "read"
276276
return -1, fserrors.New(op, filesystem.Root, filesystem.ErrIsDir, fserrors.IsDir)
277277
}
278278

279279
func (pd *pinDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
280-
const op = "pinDirectory.ReadDir"
280+
const op = "readdir"
281281
if err := pd.err; err != nil {
282282
return nil, err
283283
}
@@ -300,7 +300,7 @@ func (pd *pinDirectory) ReadDir(count int) ([]fs.DirEntry, error) {
300300
}
301301

302302
func (pd *pinDirectory) StreamDir() <-chan filesystem.StreamDirEntry {
303-
const op = "pinDirectory.StreamDir"
303+
const op = "streamdir"
304304
stream := pd.stream
305305
if stream == nil {
306306
errs := make(chan filesystem.StreamDirEntry, 1)
@@ -315,7 +315,7 @@ func (pd *pinDirectory) StreamDir() <-chan filesystem.StreamDirEntry {
315315
}
316316

317317
func (pd *pinDirectory) Close() error {
318-
const op = "pinStream.Close"
318+
const op = "close"
319319
if stream := pd.stream; stream != nil {
320320
stream.CancelFunc()
321321
pd.stream = nil

0 commit comments

Comments
 (0)