MCPcopy Create free account
hub / github.com/deepseek-ai/3FS / handleInitFileSystem

Function handleInitFileSystem

src/client/cli/admin/InitCluster.cc:46–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46CoTryTask<void> handleInitFileSystem(AdminEnv &env,
47 const argparse::ArgumentParser &parser,
48 Dispatcher::OutputTable &table) {
49 auto tableId = flat::ChainTableId(parser.get<uint32_t>("chaintableid"));
50 auto chunksize = parser.get<uint32_t>("chunksize");
51 auto stripesize = parser.get<uint32_t>("stripesize");
52
53 auto chainAlloc = std::make_unique<meta::server::ChainAllocator>(nullptr);
54 auto rootLayout = meta::Layout::newEmpty(tableId, chunksize, stripesize);
55 auto op = meta::server::MetaStore::initFileSystem(*chainAlloc, rootLayout);
56 auto handler = [&](kv::IReadWriteTransaction &txn) -> CoTryTask<void> { co_return co_await op->run(txn); };
57
58 auto commitRes = co_await kv::WithTransaction(getRetryStrategy())
59 .run(env.kvEngineGetter()->createReadWriteTransaction(), std::move(handler));
60 if (commitRes.hasError()) {
61 co_return makeError(commitRes.error().code(), fmt::format("Failed to init filesystem: {}", commitRes.error()));
62 };
63
64 table.push_back({fmt::format("Init filesystem, root directory layout: chain table {}, chunksize {}, stripesize {}\n",
65 tableId,
66 chunksize,
67 stripesize)});
68
69 co_return Void{};
70}
71
72CoTryTask<void> handleInitConfig(AdminEnv &env,
73 Dispatcher::OutputTable &table,

Callers 1

handleInitClusterFunction · 0.85

Calls 10

WithTransactionClass · 0.85
makeErrorFunction · 0.85
hasErrorMethod · 0.80
codeMethod · 0.80
push_backMethod · 0.80
getRetryStrategyFunction · 0.70
formatFunction · 0.70
runMethod · 0.45
errorMethod · 0.45

Tested by

no test coverage detected