コード例 #1
0
ファイル: agent.py プロジェクト: afeset/miner2-tools
 def setName (self, name):
     self.mySetNameGuard.crashIfInitDone()
     self.myName=name
     self._log.setInstance(name)
     for logFunc in self._log("init").debug2Func(): logFunc("Initialized")
     TrxPhase.setLogger(self._log)
     self.mySetNameGuard.initDone()
コード例 #2
0
    def handleTrxElementCommitPrivateValueSet(self, trxElement, keyDepth):
        for logFunc in self._log(
                "handle-trx-element-commit-private-value-set-details"
        ).debug2Func():
            logFunc(
                "trx-details: element-key-path=%s, element-op-code=%s, keyDepth=%s",
                trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth)
        phase = TrxPhase(TrxPhase.kCommit, TrxPhase.kPrivate)
        res = self.notifyPhase(phase)
        if (res != ReturnCodes.kOk):
            for logFunc in self._log(
                    "handle-trx-element-commit-private-value-set-failed"
            ).errorFunc():
                logFunc(
                    "handle-trx-commit-private-value-set-failed: element-key-path=%s, element-op-code=%s, keyDepth=%s, res=%s",
                    trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth,
                    res)
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
コード例 #3
0
    def handleTrxElementPreparePublicValueSet(self, trxElement, keyDepth):
        for logFunc in self._log(
                "handle-trx-element-prepare-public-value-set-details"
        ).debug2Func():
            logFunc(
                "trx-details: element-key-path=%s, element-op-code=%s, keyDepth=%s",
                trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth)
        phase = TrxPhase(TrxPhase.kPrepare, TrxPhase.kPublic)
        res = self.notifyPhase(phase)
        if (res != ReturnCodes.kOk):
            for logFunc in self._log(
                    "handle-trx-element-prepare-public-value-set-failed"
            ).noticeFunc():
                logFunc(
                    "handle-trx-prepare-public-value-set-failed: element-key-path=%s, element-op-code=%s, keyDepth=%s, res=%s",
                    trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth,
                    res)
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
コード例 #4
0
    def handleTrxElementAbortPublicValueSet(self, trxElement, keyDepth):
        for logFunc in self._log(
                "handle-trx-element-abort-public-value-set-details"
        ).debug2Func():
            logFunc(
                "trx-details: element-key-path=%s, element-op-code=%s, keyDepth=%s",
                trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth)
        phase = TrxPhase(TrxPhase.kAbort, TrxPhase.kPublic)
        res = self.notifyPhase(phase)
        if (res != ReturnCodes.kOk):
            for logFunc in self._log(
                    "handle-trx-element-abort-public-value-set-failed"
            ).errorFunc():
                logFunc("handle-trx-abort-public-value-set-failed - fatal: element-key-path=%s, "\
                       "element-op-code=%s, keyDepth=%s, res=%s",
                       trxElement.getKeyPath(), trxElement.getOpCode(), keyDepth, res)
            a.infra.process.processFatal("abort public value set failed")
            return ReturnCodes.kGeneralError

        return ReturnCodes.kOk
コード例 #5
0
ファイル: trx_progress.py プロジェクト: afeset/miner2-tools
 def getPrepareProgressStage(self):
     prepareStage = TrxProgress(
         TrxPhase(TrxPhase.kPrepare, self.myTrxPhase.getBlinkyPhase()),
         self.myProgressStage)
     return prepareStage
コード例 #6
0
 def internalAbortPublicCreate(self):
     for logFunc in self._log("internal-abort-public-create").debug2Func():
         logFunc("internalAbortPublicCreate() called")
     return self.notifyPhase(TrxPhase(TrxPhase.kAbort, TrxPhase.kPublic))
コード例 #7
0
 def internalCommitPublicCreate(self):
     for logFunc in self._log("internal-commit-public-create").debug2Func():
         logFunc("internalCommitPublicCreate() called")
     self.notifyPhase(TrxPhase(TrxPhase.kCommit, TrxPhase.kPublic))
コード例 #8
0
 def internalCommitPrivateCreate(self):
     for logFunc in self._log(
             "internal-commit-private-create").debug2Func():
         logFunc("internalCommitPrivateCreate() called")
     return self.notifyPhase(TrxPhase(TrxPhase.kCommit, TrxPhase.kPrivate))
コード例 #9
0
 def internalPreparePublicCreate(self):
     for logFunc in self._log(
             "internal-prepare-public-create").debug2Func():
         logFunc("internalPreparePublicCreate() called")
     return self.notifyPhase(TrxPhase(TrxPhase.kPrepare, TrxPhase.kPublic))