void BaseFilter::initAction() { if (m_action) return; m_action = new QAction(getIcon(), getEntryName(), this); m_action->setStatusTip(getStatusTip()); //connect this action connect(m_action, SIGNAL(triggered()), this, SLOT(performAction())); }
boost::optional<long> ContentFolder::doGetMetaDataIndexForEntry(std::string const &name) const { for (long entryIndex = 0; entryIndex < m_entryCount; ++entryIndex) { if (name == getEntryName(m_folderData, entryIndex)) { return entryIndex; } } return boost::optional<long>(); }
void TransformEditorWidget::setEditable( const Engine::ItemEntry& ent ) { delete m_translationEditor; TransformEditor::setEditable( ent ); if ( canEdit() ) { m_translationEditor = new VectorEditor(0, QString::fromStdString(getEntryName( Engine::RadiumEngine::getInstance(), m_currentEdit)), true ); connect(m_translationEditor, &VectorEditor::valueChanged, this, &TransformEditorWidget::onChangedPosition); } }
void DatabaseSync<SO>::addMissingEntries(QList<SO *> missingEntries) { // we can not check if item is really a new item because there is no way to // check locally whether it was removed w/o recycle bin if (!db1->metadata()->recycleBinEnabled()) { // TODO instead of syncing to recycle bin entries will be removed. // Show user dialog to confirm removal // Strongly recommend to the user to enable recycle bin to prevent manual // sync return; } // sort by creation time.Parent group always created before child.Sort // guaranties parents will be created before childs qSort(missingEntries.begin(), missingEntries.end(), compareByCreationTime); qDebug() << "Add missing entries of type " + getType(); Q_FOREACH(SO * entry, missingEntries) { const Group *parentGr = getParentGroup(entry); Group *group = Q_NULLPTR; QMap<Uuid, Group *> allGroups = db1->rootGroup()->groupsMapRecursive(true); if (allGroups.contains(parentGr->uuid())) group = allGroups.value(parentGr->uuid()); // handle case when missing entry should be created in recycle bin. // Could happen when entry in remote database was created and immeadiately // removed else if (db1->metadata()->recycleBin() && (db1->metadata()->recycleBin()->uuid() == parentGr->uuid())) group = db1->metadata()->recycleBin(); qDebug() << "Create new entry in the recycle bin"; Q_ASSERT(group); // creating new entry SO *newEntry = new SO(); newEntry->setUuid(entry->uuid()); newEntry->copyDataFrom(entry); setParentGroup(newEntry, group); newEntry->setTimeInfo(entry->timeInfo()); qDebug() << "Add missing " + getType() + ": " + getEntryName(newEntry) +" to group::" +group->getGroupName(); getSyncObject()->increase(getObjectType(), SMissing(), SLocal()); } }
Future<InvalidationRequired> CheckoutAction::doAction() { // All the data is ready and we're ready to go! // Check for conflicts first. return hasConflict().thenValue( [this]( bool conflictWasAddedToCtx) -> folly::Future<InvalidationRequired> { // Note that even if we know we are not going to apply the changes, we // must still run hasConflict() first because we rely on its // side-effects. if (conflictWasAddedToCtx && !ctx_->forceUpdate()) { // We only report conflicts for files, not directories. The only // possible conflict that can occur here if this inode is a TreeInode // is that the old source control state was for a file. There aren't // really any other conflicts than this to report, even if we recurse. // Anything inside this directory is basically just untracked (or // possibly ignored) files. return InvalidationRequired::No; } // Call TreeInode::checkoutUpdateEntry() to actually do the work. // // Note that we are moving most of our state into the // checkoutUpdateEntry() arguments. We have to be slightly careful // here: getEntryName() returns a PathComponentPiece that is pointing // into a PathComponent owned either by oldScmEntry_ or newScmEntry_. // Therefore don't move these scm entries, to make sure we don't // invalidate the PathComponentPiece data. auto parent = inode_->getParent(ctx_->renameLock()); return parent->checkoutUpdateEntry( ctx_, getEntryName(), std::move(inode_), std::move(oldTree_), std::move(newTree_), newScmEntry_); }); }
bool LookupIntentMsgEx::processIncoming(struct sockaddr_in* fromAddr, Socket* sock, char* respBuf, size_t bufLen, HighResolutionStats* stats) { #ifdef BEEGFS_DEBUG const char* msgInContext = "LookupIntentMsg incoming"; std::string peer = fromAddr ? Socket::ipaddrToStr(&fromAddr->sin_addr) : sock->getPeername(); LOG_DEBUG(msgInContext, 4, std::string("Received a LookupIntentMsg from: ") + peer); #endif App* app = Program::getApp(); std::string parentEntryID = getParentInfo()->getEntryID(); FhgfsOpsErr lookupRes = FhgfsOpsErr_INTERNAL; FhgfsOpsErr createRes = FhgfsOpsErr_INTERNAL; std::string entryName = getEntryName(); const char* logContext = "LookupIntentMsg"; LOG_DEBUG(logContext, 5, "parentID: '" + parentEntryID + "' " + "entryName: '" + entryName + "'"); // (note: following objects must be at the top-level stack frame for response serialization) std::string fileHandleID; Raid0Pattern dummyPattern(1, UInt16Vector() ); EntryInfo diskEntryInfo; int createFlag = getIntentFlags() & LOOKUPINTENTMSG_FLAG_CREATE; FileInodeStoreData inodeData; bool inodeDataOutdated = false; // true if the file/inode is currently open (referenced) LookupIntentRespMsg respMsg(FhgfsOpsErr_INTERNAL); PathInfo pathInfo; /* Added to NetMessage as ref-pointer, so object needs to exist until * the NetMessage got serialized! */ // sanity checks if (unlikely (parentEntryID.empty() || entryName.empty() ) ) { LogContext(logContext).log(3, "Sanity check failed: parentEntryID: '" + parentEntryID + "'" + "entryName: '" + entryName + "'"); // something entirely wrong, fail immediately, error already set above goto send_response; } /* Note: Actually we should first do a lookup. However, a successful create also implies a failed Lookup, so we can take a shortcut. */ // lookup-create if (createFlag) { LOG_DEBUG(logContext, Log_SPAM, "Lookup: create"); // checks in create() if lookup already found the entry createRes = create(this->getParentInfo(), entryName, &diskEntryInfo, &inodeData); FhgfsOpsErr sendCreateRes; if (createRes == FhgfsOpsErr_SUCCESS) { sendCreateRes = FhgfsOpsErr_SUCCESS; // Successful Create, which implies Lookup-before-create would have been failed. respMsg.setLookupResult(FhgfsOpsErr_PATHNOTEXISTS); respMsg.setEntryInfo(&diskEntryInfo); } else { if (createRes == FhgfsOpsErr_EXISTS) { // NOTE: we need to do a Lookup to get required lookup data if (getIntentFlags() & LOOKUPINTENTMSG_FLAG_CREATEEXCLUSIVE) sendCreateRes = FhgfsOpsErr_EXISTS; else sendCreateRes = FhgfsOpsErr_SUCCESS; } else sendCreateRes = FhgfsOpsErr_INTERNAL; } respMsg.addResponseCreate(sendCreateRes); // note: don't quit here on error because caller might still have requested stat info } // lookup if ((!createFlag) || (createRes == FhgfsOpsErr_EXISTS) ) { LOG_DEBUG(logContext, Log_SPAM, "Lookup: lookup"); lookupRes = lookup(parentEntryID, entryName, &diskEntryInfo, &inodeData, inodeDataOutdated); respMsg.setLookupResult(lookupRes); if (lookupRes == FhgfsOpsErr_SUCCESS) respMsg.setEntryInfo(&diskEntryInfo); if(unlikely( (lookupRes != FhgfsOpsErr_SUCCESS) && createFlag) ) { // so createFlag is set, so createRes is either Success or Exists, but now lookup fails // create/unlink race? // we need to set something here, as sendCreateRes = FhgfsOpsErr_SUCCESS respMsg.setEntryInfo(&diskEntryInfo); StatData statData; statData.setAllFake(); // set arbitrary stat values (receiver won't use the values) respMsg.addResponseStat(lookupRes, &statData); goto send_response; } } // lookup-revalidate if(getIntentFlags() & LOOKUPINTENTMSG_FLAG_REVALIDATE) { LOG_DEBUG(logContext, Log_SPAM, "Lookup: revalidate"); FhgfsOpsErr revalidateRes = revalidate(&diskEntryInfo); respMsg.addResponseRevalidate(revalidateRes); if(revalidateRes != FhgfsOpsErr_SUCCESS) goto send_response; } /* lookup-stat note: we do stat before open to avoid the dyn attribs refresh if the file is not opened by someone else currently. */ if ( (getIntentFlags() & LOOKUPINTENTMSG_FLAG_STAT) && (lookupRes == FhgfsOpsErr_SUCCESS || createRes == FhgfsOpsErr_SUCCESS) ) { LOG_DEBUG(logContext, Log_SPAM, "Lookup: stat"); // check if lookup and create failed (we don't have an entryID to stat then) if(diskEntryInfo.getEntryID().empty() ) goto send_response; if ( (diskEntryInfo.getFlags() & ENTRYINFO_FEATURE_INLINED) && !inodeDataOutdated) { // stat-data from the dentry StatData* dentryStatData = inodeData.getInodeStatData(); respMsg.addResponseStat(FhgfsOpsErr_SUCCESS, dentryStatData); } else { // read stat data separately StatData statData; FhgfsOpsErr statRes = stat(&diskEntryInfo, true, statData); respMsg.addResponseStat(statRes, &statData); if(statRes != FhgfsOpsErr_SUCCESS) goto send_response; } } // lookup-open if(getIntentFlags() & LOOKUPINTENTMSG_FLAG_OPEN) { LOG_DEBUG(logContext, Log_SPAM, "Lookup: open"); // don't open if create failed if ((createRes != FhgfsOpsErr_SUCCESS) && (getIntentFlags() & LOOKUPINTENTMSG_FLAG_CREATE) ) goto send_response; if (!DirEntryType_ISREGULARFILE(diskEntryInfo.getEntryType() ) ) goto send_response; // not a regular file, we don't open that // check if lookup and/or create failed (we don't have an entryID to open then) if(diskEntryInfo.getEntryID().empty() ) goto send_response; StripePattern* pattern = NULL; FhgfsOpsErr openRes = open(&diskEntryInfo, &fileHandleID, &pattern, &pathInfo); if(openRes != FhgfsOpsErr_SUCCESS) { // open failed => use dummy pattern for response respMsg.addResponseOpen(openRes, fileHandleID, &dummyPattern, &pathInfo); goto send_response; } respMsg.addResponseOpen(openRes, fileHandleID, pattern, &pathInfo); } send_response: respMsg.serialize(respBuf, bufLen); sock->sendto(respBuf, respMsg.getMsgLength(), 0, (struct sockaddr*)fromAddr, sizeof(struct sockaddr_in) ); app->getNodeOpStats()->updateNodeOp(sock->getPeerIP(), this->getOpCounterType(), getMsgHeaderUserID() ); return true; }