public HaRequestType(TargetCaller targetCaller, ObjectSerializer objectSerializer, sbyte id, bool unpack) { this._targetCaller = targetCaller; this._objectSerializer = objectSerializer; this._id = id; this._unpack = unpack; }
private void RegisterHandshake() { TargetCaller <Master, HandshakeResult> handshakeTarget = (master, context, input, target) => master.handshake(input.readLong(), null); ObjectSerializer <HandshakeResult> handshakeResultObjectSerializer = (responseObject, result) => { result.writeLong(responseObject.txChecksum()); result.writeLong(responseObject.epoch()); }; Register(HaRequestTypes_Type.Handshake, handshakeTarget, handshakeResultObjectSerializer); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldHandleNoForensicsSpecifiedInFullBackupRequest() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void ShouldHandleNoForensicsSpecifiedInFullBackupRequest() { TheBackupInterface backup = mock(typeof(TheBackupInterface)); RequestContext ctx = new RequestContext(0, 1, 0, -1, 12); //JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") org.neo4j.com.TargetCaller<org.neo4j.backup.TheBackupInterface, Void> targetCaller = (org.neo4j.com.TargetCaller<org.neo4j.backup.TheBackupInterface,Void>) org.neo4j.backup.impl.BackupClient.BackupRequestType.FULL_BACKUP.getTargetCaller(); TargetCaller <TheBackupInterface, Void> targetCaller = (TargetCaller <TheBackupInterface, Void>)BackupRequestType.FULL_BACKUP.TargetCaller; targetCaller.Call(backup, ctx, EMPTY_BUFFER, null); verify(backup).fullBackup(any(typeof(StoreWriter)), eq(false)); }
private void RegisterEndLockSession() { // NOTE <1>: A 'false' argument for 'unpack' means we won't unpack the response. // We do this because END_LOCK_SESSION request can be send in 3 cases: // 1) transaction committed successfully // 2) transaction rolled back successfully // 3) transaction was terminated // Master's response for this call is an obligation to pull up to a specified txId. // Processing/unpacking of this response is not needed in all 3 cases: // 1) committed transaction pulls transaction stream as part of COMMIT call // 2) rolled back transaction does not care about reading any more // 3) terminated transaction does not care about reading any more TargetCaller <Master, Void> endLockSessionTarget = (master, context, input, target) => master.endLockSession(context, readBoolean(input)); Register(HaRequestTypes_Type.EndLockSession, endLockSessionTarget, VOID_SERIALIZER, false); }
private void RegisterCommit(LogEntryReader <ReadableClosablePositionAwareChannel> entryReader) { TargetCaller <Master, long> commitTarget = (master, context, input, target) => { readString(input); // Always neostorexadatasource TransactionRepresentation tx; try { Deserializer <TransactionRepresentation> deserializer = new Protocol.TransactionRepresentationDeserializer(entryReader); tx = deserializer.read(input, null); } catch (IOException e) { throw new Exception(e); } return(master.commit(context, tx)); }; Register(HaRequestTypes_Type.Commit, commitTarget, LONG_SERIALIZER); }
private void RegisterAllocateIds() { TargetCaller <Master, IdAllocation> allocateIdTarget = (master, context, input, target) => { IdType idType = IdType.values()[input.readByte()]; return(master.allocateIds(context, idType)); }; ObjectSerializer <IdAllocation> allocateIdSerializer = (idAllocation, result) => { IdRange idRange = idAllocation.IdRange; result.writeInt(idRange.DefragIds.length); foreach (long id in idRange.DefragIds) { result.writeLong(id); } result.writeLong(idRange.RangeStart); result.writeInt(idRange.RangeLength); result.writeLong(idAllocation.HighestIdInUse); result.writeLong(idAllocation.DefragCount); }; Register(HaRequestTypes_Type.AllocateIds, allocateIdTarget, allocateIdSerializer); }
protected internal virtual void Register <A, B, C>(HaRequestTypes_Type type, TargetCaller <A, B> targetCaller, ObjectSerializer <C> objectSerializer, bool unpack) { Debug.Assert(_types[type.ordinal()] == null); _types[type.ordinal()] = new HaRequestType(targetCaller, objectSerializer, (sbyte)type.ordinal(), unpack); }
protected internal virtual void Register <A, B, C>(HaRequestTypes_Type type, TargetCaller <A, B> targetCaller, ObjectSerializer <C> objectSerializer) { Register(type, targetCaller, objectSerializer, true); }
private void RegisterCreateRelationshipType() { TargetCaller <Master, int> createRelationshipTypeTarget = (master, context, input, target) => master.createRelationshipType(context, readString(input)); Register(HaRequestTypes_Type.CreateRelationshipType, createRelationshipTypeTarget, INTEGER_SERIALIZER); }
private void RegisterCreatePropertyKey() { TargetCaller <Master, int> createPropertyKeyTarget = (master, context, input, target) => master.createPropertyKey(context, readString(input)); Register(HaRequestTypes_Type.CreatePropertyKey, createPropertyKeyTarget, INTEGER_SERIALIZER); }
private void RegisterNewLockSession() { TargetCaller <Master, Void> newLockSessionTarget = (master, context, input, target) => master.newLockSession(context); Register(HaRequestTypes_Type.NewLockSession, newLockSessionTarget, VOID_SERIALIZER); }
private void RegisterCopyStore() { TargetCaller <Master, Void> copyStoreTarget = (master, context, input, target) => master.copyStore(context, new ToNetworkStoreWriter(target, new Monitors())); Register(HaRequestTypes_Type.CopyStore, copyStoreTarget, VOID_SERIALIZER, false); }
private void RegisterPullUpdates() { TargetCaller <Master, Void> pullUpdatesTarget = (master, context, input, target) => master.pullUpdates(context); Register(HaRequestTypes_Type.PullUpdates, pullUpdatesTarget, VOID_SERIALIZER); }