size_t Pipe::write(HANDLE handle, void* buffer, DWORD bytesToWrite) { size_t bytesWritten = 0; DWORD written = 0; DWORD remainingBytes = bytesToWrite; while (remainingBytes > 0) { if (!WriteFile( handle, (void*)((char*)buffer + bytesWritten), remainingBytes, &written, nullptr)) { DWORD error = GetLastError(); XLOGF( ERR, "Error while writing to the pipe : bytesWritten {}, {} : {}", bytesWritten, error, win32ErrorToString(error)); throw makeWin32ErrorExplicit(error, "Error while writing to the pipe"); } bytesWritten += written; remainingBytes -= written; } XLOG(DBG5) << "Pipe::Write-- bytesToWrite:" << bytesToWrite << "bytesWritten" << bytesWritten << std::endl; return bytesWritten; }
size_t Pipe::read(HANDLE handle, void* buffer, DWORD bytesToRead) { size_t bytesRead = 0; DWORD read = 0; DWORD remainingBytes = bytesToRead; while (remainingBytes > 0) { if (!ReadFile( handle, ((char*)buffer + bytesRead), remainingBytes, &read, nullptr)) { DWORD error = GetLastError(); XLOGF( ERR, "Error while reading from the pipe : bytesRead {}, Error: {} : {}", bytesRead, error, win32ErrorToString(error)); throw makeWin32ErrorExplicit(error, "Error while reading from the pipe"); } bytesRead += read; remainingBytes -= read; } XLOG(DBG5) << "Pipe::read-- bytesToRead:" << bytesToRead << "bytesRead" << bytesRead << std::endl; return bytesRead; }
void EdenMount::destroy() { XLOGF( INFO, "Destroying EdenMount (0x{:x})", reinterpret_cast<uintptr_t>(this)); auto oldState = state_.exchange(State::DESTROYING); switch (oldState) { case State::RUNNING: stop(); break; } delete this; }
EdenMount::EdenMount( std::unique_ptr<ClientConfig> config, std::shared_ptr<ObjectStore> objectStore, std::shared_ptr<ServerState> serverState) : config_{std::move(config)}, serverState_{std::move(serverState)}, objectStore_{std::move(objectStore)}, straceLogger_{kEdenStracePrefix.str() + config_->getMountPath().value()}, dispatcher_{this}, fsChannel_{config_->getMountPath(), this}, mountGeneration_{generateLuid()} { auto parents = std::make_shared<ParentCommits>(config_->getParentCommits()); XLOGF( INFO, "Creating eden mount {} Parent Commit {}", getPath(), parents->parent1().toString()); parentInfo_.wlock()->parents.setParents(*parents); }
ExampleObject::~ExampleObject() { // All XLOG() statements in this file will log to the category // folly.experimental.logging.example.lib XLOGF(DBG1, "ExampleObject({}) at {} destroyed", value_, this); }