MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / beginWrite

Method beginWrite

src/gui2/datastore.cc:556–620  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

554}
555
556void Datastore::beginWrite()
557{
558 Events::OperationStart::post("fluxengine.view.status.writeDevice"_lang);
559 Datastore::runOnWorkerThread(
560 []
561 {
562 busy = true;
563 failed = false;
564 DEFER(wtOperationStop());
565
566 try
567 {
568 wtRebuildConfiguration(true);
569 wtWaitForUiThreadToCatchUp();
570
571 auto fluxSinkFactory = FluxSinkFactory::create(globalConfig());
572 auto encoder = Arch::createEncoder(globalConfig());
573 std::shared_ptr<Decoder> decoder;
574 std::shared_ptr<FluxSource> verificationFluxSource;
575 if (globalConfig().hasDecoder() &&
576 fluxSinkFactory->isHardware())
577 {
578 decoder = Arch::createDecoder(globalConfig());
579 verificationFluxSource = FluxSource::create(
580 globalConfig().getVerificationFluxSourceProto());
581 }
582
583 auto path = fluxSinkFactory->getPath();
584 if (path.has_value() && std::filesystem::exists(*path))
585 {
586 {
587 bool result;
588 wtRunSynchronouslyOnUiThread((
589 std::function<void()>)[&] {
590 hex::ui::PopupQuestion::open(
591 "fluxengine.messages.writingFluxToFile"_lang,
592 [&]
593 {
594 result = true;
595 },
596 [&]
597 {
598 result = false;
599 });
600 });
601 if (!result)
602 throw EmergencyStopException();
603 }
604 }
605
606 auto image = disk->image;
607 writeDiskCommand(*diskLayout,
608 *image,
609 *encoder,
610 *fluxSinkFactory,
611 decoder.get(),
612 verificationFluxSource.get());
613 }

Callers

nothing calls this directly

Calls 11

runOnWorkerThreadFunction · 0.85
wtOperationStopFunction · 0.85
wtRebuildConfigurationFunction · 0.85
writeDiskCommandFunction · 0.85
hasDecoderMethod · 0.80
isHardwareMethod · 0.45
getPathMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected