ipfs / ipfs/kubo

coreunix: addFile: encapsulate `FlushMemFree` call

Open
#5,060 0 comments 0 reactions 0 assignees View on GitHub
topic/docs-ipfs topic/files
Dominant language
Go
Stars
17.1k
Forks
3.2k
Avg merge
3d 18h
Merged PRs (30d)
11

Description

The `addFile` functions is pretty much the entry point for anyone looking to understand what is going on when calling `ipfs add` so it would be useful to keep it as clean as possible, I think the flush logic added in https://github.com/ipfs/go-ipfs/pull/3888 could be encapsulated in a separate function.

https://github.com/ipfs/go-ipfs/blob/7853e53860805e08a212d78c4baa5d59bff99ba8/core/coreunix/add.go#L421-L439

(Also we could make `liveCacheSize` a `const` and document its use and the value chosen.)

Contributor guide

Open the contributing guide

Research direction

Start in core/coreunix/add.go at the linked addFile code and inspect the existing FlushMemFree logic. Extract that logic into a separate function, then consider the requested liveCacheSize constant and documentation; done when addFile is cleaner and the existing coreunix checks still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.