public StorageActionsAccessor(StorageMutator mutator, StorageReader viewer, Stream reader, Stream writer) { this.mutator = mutator; this.viewer = viewer; this.reader = reader; this.writer = writer; }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraints() public virtual void ShouldListAllConstraints() { // Given SchemaHelper.createUniquenessConstraint(Db, Label1, PropertyKey); SchemaHelper.createUniquenessConstraint(Db, Label2, PropertyKey); SchemaHelper.createNodeKeyConstraint(Db, Label1, OtherPropertyKey); SchemaHelper.createNodeKeyConstraint(Db, Label2, OtherPropertyKey); SchemaHelper.createNodePropertyExistenceConstraint(Db, Label2, PropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey); SchemaHelper.awaitIndexes(Db); // When ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetAll()); // Then int labelId1 = LabelId(Label1); int labelId2 = LabelId(Label2); int relTypeId = RelationshipTypeId(RelType1); int propKeyId = PropertyKeyId(PropertyKey); int propKeyId2 = PropertyKeyId(OtherPropertyKey); assertThat(constraints, containsInAnyOrder(ConstraintDescriptorFactory.uniqueForLabel(labelId1, propKeyId), ConstraintDescriptorFactory.uniqueForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.nodeKeyForLabel(labelId1, propKeyId2), ConstraintDescriptorFactory.nodeKeyForLabel(labelId2, propKeyId2), ConstraintDescriptorFactory.existsForLabel(labelId2, propKeyId), ConstraintDescriptorFactory.existsForRelType(relTypeId, propKeyId))); }
private int DegreeForDirectionAndType(StorageNodeCursor cursor, RelationshipDirection direction, int relType) { int degree = 0; using (StorageRelationshipGroupCursor groups = StorageReader.allocateRelationshipGroupCursor()) { groups.Init(cursor.EntityReference(), cursor.RelationshipGroupReference()); while (groups.Next()) { if (relType == ANY_RELATIONSHIP_TYPE || relType == groups.Type()) { switch (direction) { case RelationshipDirection.OUTGOING: degree += groups.OutgoingCount() + groups.LoopCount(); break; case RelationshipDirection.INCOMING: degree += groups.IncomingCount() + groups.LoopCount(); break; case RelationshipDirection.LOOP: degree += groups.OutgoingCount() + groups.IncomingCount() + groups.LoopCount(); break; default: throw new System.ArgumentException(direction.name()); } } } } return(degree); }
public FileSystemServer() { Runtime.UpdateFrequency = UpdateFrequency.Update1; try { StorageReader storage_data = new StorageReader(Storage); if (Storage.Length > 0) { uint num_users = storage_data.ReadUInt32(); for (uint i = 0U; i != num_users; i++) { string user_name = storage_data.ReadString(); string password = storage_data.ReadString(); if (!(users.ContainsKey(user_name))) { users.Add(user_name, new User(user_name, password)); } } uint num_files = storage_data.ReadUInt32(); for (uint i = 0U; i != num_files; i++) { string path = storage_data.ReadString(); string owner = storage_data.ReadString(); FileFlags read_write_flags = (FileFlags)(storage_data.ReadByte()); byte[] data = storage_data.ReadByteSequence(); files.Add(path, new File(path, owner, (read_write_flags & FileFlags.CanEveryoneRead) == FileFlags.CanEveryoneRead, (read_write_flags & FileFlags.CanEveryoneWrite) == FileFlags.CanEveryoneWrite, data)); } } } catch (StorageReaderArgumentException e) { Echo(e.ToString()); } fileSystemListener = IGC.RegisterBroadcastListener(fileSystemServerTag); }
public StorageReader(StorageReader storage) { if (storage != null) { data = (byte[])(storage.data.Clone()); } }
private KernelTransactionImplementation CreateTransaction() { KernelTransactionImplementation transaction = mock(typeof(KernelTransactionImplementation)); try { TransactionHeaderInformation headerInformation = new TransactionHeaderInformation(-1, -1, new sbyte[0]); TransactionHeaderInformationFactory headerInformationFactory = mock(typeof(TransactionHeaderInformationFactory)); when(headerInformationFactory.Create()).thenReturn(headerInformation); StorageEngine storageEngine = mock(typeof(StorageEngine)); StorageReader storageReader = mock(typeof(StorageReader)); when(storageEngine.NewReader()).thenReturn(storageReader); SimpleStatementLocks locks = new SimpleStatementLocks(mock(typeof(Org.Neo4j.Kernel.impl.locking.Locks_Client))); when(transaction.StatementLocks()).thenReturn(locks); when(transaction.TokenRead()).thenReturn(_tokenRead); when(transaction.SchemaRead()).thenReturn(_schemaRead); when(transaction.SchemaWrite()).thenReturn(_schemaWrite); TransactionState transactionState = mock(typeof(TransactionState)); when(transaction.TxState()).thenReturn(transactionState); when(transaction.IndexUniqueCreate(any(typeof(SchemaDescriptor)), any(typeof(string)))).thenAnswer(i => IndexDescriptorFactory.uniqueForSchema(i.getArgument(0))); } catch (InvalidTransactionTypeKernelException) { fail("Expected write transaction"); } catch (SchemaKernelException e) { throw new Exception(e); } return(transaction); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private org.neo4j.storageengine.api.StorageNodeCursor newCursor(long nodeId) private StorageNodeCursor NewCursor(long nodeId) { StorageNodeCursor nodeCursor = StorageReader.allocateNodeCursor(); nodeCursor.Single(nodeId); assertTrue(nodeCursor.Next()); return(nodeCursor); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("deprecation") @Before public void before() public virtual void Before() { Db = ( GraphDatabaseAPI )CreateGraphDatabase(); DependencyResolver resolver = Db.DependencyResolver; this.StorageReader = resolver.ResolveDependency(typeof(StorageEngine)).newReader(); this.State = new KernelStatement(null, null, StorageReader, LockTracer.NONE, null, new ClockContext(), EmptyVersionContextSupplier.EMPTY); }
private bool RelationshipExists(long id) { using (StorageRelationshipScanCursor relationship = StorageReader.allocateRelationshipScanCursor()) { relationship.Single(id); return(relationship.Next()); } }
private bool NodeExists(long id) { using (StorageNodeCursor node = StorageReader.allocateNodeCursor()) { node.Single(id); return(node.Next()); } }
protected internal PropertyAwareEntityStoreScan(StorageReader storageReader, long totalEntityCount, System.Func <int, bool> propertyKeyIdFilter, System.Func <long, Lock> lockFunction) { this._storageReader = storageReader; this.EntityCursor = AllocateCursor(storageReader); this._propertyCursor = storageReader.AllocatePropertyCursor(); this._propertyKeyIdFilter = propertyKeyIdFilter; this._lockFunction = lockFunction; this._totalCount = totalEntityCount; this._phaseTracker = Org.Neo4j.Kernel.Impl.Api.index.PhaseTracker_Fields.NullInstance; }
public TxStateTransactionDataSnapshot(ReadableTransactionState state, EmbeddedProxySPI proxySpi, StorageReader storageReader, KernelTransaction transaction) { this._state = state; this._proxySpi = proxySpi; this._store = storageReader; this._transaction = transaction; // Load changes that require store access eagerly, because we won't have access to the after-state // after the tx has been committed. TakeSnapshot(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private org.neo4j.storageengine.api.StorageReader prepareStorageReaderMock(java.util.List<org.neo4j.internal.kernel.api.schema.constraints.ConstraintDescriptor> descriptors) private StorageReader PrepareStorageReaderMock(IList <ConstraintDescriptor> descriptors) { StorageReader storageReader = Mockito.mock(typeof(StorageReader)); when(storageReader.ConstraintsGetAll()).thenReturn(descriptors.GetEnumerator()); when(storageReader.GetOrCreateSchemaDependantState(eq(typeof(PropertyExistenceEnforcer)), any(typeof(System.Func)))).thenAnswer(invocation => { Function <StorageReader, PropertyExistenceEnforcer> function = invocation.getArgument(1); return(function.apply(storageReader)); }); return(storageReader); }
public KernelStatement(KernelTransactionImplementation transaction, TxStateHolder txStateHolder, StorageReader storageReader, LockTracer systemLockTracer, StatementOperationParts statementOperations, ClockContext clockContext, VersionContextSupplier versionContextSupplier) { this._transaction = transaction; this._txStateHolder = txStateHolder; this._storageReader = storageReader; this._facade = new OperationsFacade(this, statementOperations); this._executingQueryList = ExecutingQueryList.EMPTY; this._systemLockTracer = systemLockTracer; this._statementOpenCloseCalls = _recordStatementsTraces ? new LinkedList <StackTraceElement[]>() : _emptyStatementHistory; this._clockContext = clockContext; this._versionContextSupplier = versionContextSupplier; }
private ISet <TestRelType> RelTypes(StorageNodeCursor cursor) { ISet <TestRelType> types = new HashSet <TestRelType>(); using (StorageRelationshipGroupCursor groups = StorageReader.allocateRelationshipGroupCursor()) { groups.Init(cursor.EntityReference(), cursor.RelationshipGroupReference()); while (groups.Next()) { types.Add(RelTypeForId(groups.Type())); } } return(types); }
private ISet <TestDegreeItem> Degrees(StorageNodeCursor nodeCursor) { ISet <TestDegreeItem> degrees = new HashSet <TestDegreeItem>(); using (StorageRelationshipGroupCursor groups = StorageReader.allocateRelationshipGroupCursor()) { groups.Init(nodeCursor.EntityReference(), nodeCursor.RelationshipGroupReference()); while (groups.Next()) { degrees.Add(new TestDegreeItem(groups.Type(), groups.OutgoingCount() + groups.LoopCount(), groups.IncomingCount() + groups.LoopCount())); } } return(degrees); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraintsForRelationshipType() public virtual void ShouldListAllConstraintsForRelationshipType() { // Given SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, PropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, OtherPropertyKey); // When ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForRelationshipType(RelationshipTypeId(RelType2))); // Then ISet <ConstraintDescriptor> expectedConstraints = Iterators.asSet(RelationshipPropertyExistenceDescriptor(RelType2, PropertyKey), RelationshipPropertyExistenceDescriptor(RelType2, OtherPropertyKey)); assertEquals(expectedConstraints, constraints); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void constraintPropertyIdsNotUpdatedByConstraintEnforcer() public virtual void ConstraintPropertyIdsNotUpdatedByConstraintEnforcer() { UniquenessConstraintDescriptor uniquenessConstraint = ConstraintDescriptorFactory.uniqueForLabel(1, 1, 70, 8); NodeKeyConstraintDescriptor nodeKeyConstraint = ConstraintDescriptorFactory.nodeKeyForLabel(2, 12, 7, 13); RelExistenceConstraintDescriptor relTypeConstraint = ConstraintDescriptorFactory.existsForRelType(3, 5, 13, 8); IList <ConstraintDescriptor> descriptors = Arrays.asList(uniquenessConstraint, nodeKeyConstraint, relTypeConstraint); StorageReader storageReader = PrepareStorageReaderMock(descriptors); PropertyExistenceEnforcer.GetOrCreatePropertyExistenceEnforcerFrom(storageReader); assertArrayEquals("Property ids should remain untouched.", new int[] { 1, 70, 8 }, uniquenessConstraint.Schema().PropertyIds); assertArrayEquals("Property ids should remain untouched.", new int[] { 12, 7, 13 }, nodeKeyConstraint.Schema().PropertyIds); assertArrayEquals("Property ids should remain untouched.", new int[] { 5, 13, 8 }, relTypeConstraint.Schema().PropertyIds); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllIndexes() public virtual void ShouldListAllIndexes() { // Given CreateIndex(Label1, PropertyKey); CreateIndex(Label2, PropertyKey); // When ISet <CapableIndexDescriptor> indexes = asSet(StorageReader.indexesGetAll()); // Then //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<?> expectedIndexes = asSet(indexDescriptor(label1, propertyKey), indexDescriptor(label2, propertyKey)); ISet <object> expectedIndexes = asSet(IndexDescriptor(Label1, PropertyKey), IndexDescriptor(Label2, PropertyKey)); assertEquals(expectedIndexes, indexes); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraintsForLabelAndProperty() public virtual void ShouldListAllConstraintsForLabelAndProperty() { // Given CreateUniquenessConstraint(Label1, PropertyKey); CreateUniquenessConstraint(Label1, OtherPropertyKey); // When ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForSchema(UniqueConstraintDescriptor(Label1, PropertyKey).schema())); // Then //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<?> expectedConstraints = asSet(uniqueConstraintDescriptor(label1, propertyKey)); ISet <object> expectedConstraints = asSet(UniqueConstraintDescriptor(Label1, PropertyKey)); assertEquals(expectedConstraints, constraints); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: //ORIGINAL LINE: private org.neo4j.kernel.impl.api.TransactionToApply createNodeAndProperty(int progress) throws Exception internal virtual TransactionToApply CreateNodeAndProperty(int progress) { TransactionState txState = new TxState(); long nodeId = NodeIds.nextId(); txState.NodeDoCreate(nodeId); txState.NodeDoAddLabel(outerInstance.descriptor.LabelId, nodeId); txState.NodeDoAddProperty(nodeId, outerInstance.descriptor.PropertyId, PropertyValue(Id, progress)); ICollection <StorageCommand> commands = new List <StorageCommand>(); using (StorageReader statement = StorageEngine.newReader()) { StorageEngine.createCommands(commands, txState, statement, null, 0, NO_DECORATION); } return(Tx(commands)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldReturnAllNodesWithLabel() public virtual void ShouldReturnAllNodesWithLabel() { // GIVEN Node node1 = CreateLabeledNode(Db, map("name", "First", "age", 1L), Label1); Node node2 = CreateLabeledNode(Db, map("type", "Node", "count", 10), Label1, Label2); int labelId1 = LabelId(Label1); int labelId2 = LabelId(Label2); // WHEN LongIterator nodesForLabel1 = StorageReader.nodesGetForLabel(labelId1); LongIterator nodesForLabel2 = StorageReader.nodesGetForLabel(labelId2); // THEN assertEquals(asSet(node1.Id, node2.Id), PrimitiveLongCollections.toSet(nodesForLabel1)); assertEquals(asSet(node2.Id), PrimitiveLongCollections.toSet(nodesForLabel2)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @SuppressWarnings("unchecked") private org.neo4j.storageengine.api.StorageEngine mockedStorageEngine() throws Exception //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: private StorageEngine MockedStorageEngine() { StorageEngine storageEngine = mock(typeof(StorageEngine)); doAnswer(invocation => { ICollection <StorageCommand> target = invocation.getArgument(0); ReadableTransactionState txState = invocation.getArgument(1); txState.accept(new AdapterAnonymousInnerClass(this, target)); return(null); }).when(storageEngine).createCommands(anyCollection(), any(typeof(ReadableTransactionState)), any(typeof(StorageReader)), any(typeof(ResourceLocker)), anyLong(), any(typeof(TxStateVisitor.Decorator))); StorageReader readLayer = mock(typeof(StorageReader)); when(storageEngine.NewReader()).thenReturn(readLayer); return(storageEngine); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraintsAtTimeOfSnapshot() public virtual void ShouldListAllConstraintsAtTimeOfSnapshot() { // Given CreateUniquenessConstraint(Label1, PropertyKey); // When StorageSchemaReader snapshot = StorageReader.schemaSnapshot(); CreateUniquenessConstraint(Label2, PropertyKey); ISet <ConstraintDescriptor> constraints = asSet(snapshot.ConstraintsGetAll()); // Then //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Set<?> expectedConstraints = asSet(uniqueConstraintDescriptor(label1, propertyKey)); ISet <object> expectedConstraints = asSet(UniqueConstraintDescriptor(Label1, PropertyKey)); assertEquals(expectedConstraints, constraints); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void transactionClosesUnderlyingStoreReaderWhenDisposed() throws Throwable //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void TransactionClosesUnderlyingStoreReaderWhenDisposed() { StorageReader storeStatement1 = mock(typeof(StorageReader)); StorageReader storeStatement2 = mock(typeof(StorageReader)); StorageReader storeStatement3 = mock(typeof(StorageReader)); KernelTransactions kernelTransactions = newKernelTransactions(mock(typeof(TransactionCommitProcess)), storeStatement1, storeStatement2, storeStatement3); // start and close 3 transactions from different threads StartAndCloseTransaction(kernelTransactions); Executors.newSingleThreadExecutor().submit(() => startAndCloseTransaction(kernelTransactions)).get(); Executors.newSingleThreadExecutor().submit(() => startAndCloseTransaction(kernelTransactions)).get(); kernelTransactions.DisposeAll(); verify(storeStatement1).close(); verify(storeStatement2).close(); verify(storeStatement3).close(); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void gettingIndexStateOfDroppedIndexViaSnapshotShouldThrow() public virtual void GettingIndexStateOfDroppedIndexViaSnapshotShouldThrow() { // Given CreateIndex(Label1, PropertyKey); // When StorageSchemaReader snapshot = StorageReader.schemaSnapshot(); DropIndex(Label1, PropertyKey); try { snapshot.IndexGetState(IndexDescriptor(Label1, PropertyKey)); fail("Should have thrown exception when asking for state of dropped index."); } catch (IndexNotFoundKernelException) { // Good. } }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraintsForRelationshipTypeAndProperty() public virtual void ShouldListAllConstraintsForRelationshipTypeAndProperty() { // Given SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, PropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType1, OtherPropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, PropertyKey); SchemaHelper.createRelPropertyExistenceConstraint(Db, RelType2, OtherPropertyKey); // When int relTypeId = RelationshipTypeId(RelType1); int propKeyId = PropertyKeyId(PropertyKey); ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForSchema(SchemaDescriptorFactory.forRelType(relTypeId, propKeyId))); // Then ISet <ConstraintDescriptor> expectedConstraints = Iterators.asSet(RelationshipPropertyExistenceDescriptor(RelType1, PropertyKey)); assertEquals(expectedConstraints, constraints); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldListAllConstraintsForLabel() public virtual void ShouldListAllConstraintsForLabel() { // Given SchemaHelper.createNodePropertyExistenceConstraint(Db, Label1, PropertyKey); SchemaHelper.createNodePropertyExistenceConstraint(Db, Label2, PropertyKey); SchemaHelper.createUniquenessConstraint(Db, Label1, PropertyKey); SchemaHelper.createNodeKeyConstraint(Db, Label1, OtherPropertyKey); SchemaHelper.createNodeKeyConstraint(Db, Label2, OtherPropertyKey); SchemaHelper.awaitIndexes(Db); // When ISet <ConstraintDescriptor> constraints = asSet(StorageReader.constraintsGetForLabel(LabelId(Label1))); // Then ISet <ConstraintDescriptor> expectedConstraints = asSet(UniqueConstraintDescriptor(Label1, PropertyKey), NodeKeyConstraintDescriptor(Label1, OtherPropertyKey), NodePropertyExistenceDescriptor(Label1, PropertyKey)); assertEquals(expectedConstraints, constraints); }
private sbyte[] CreateCommands(string tokenName) { StorageEngine storageEngine = _storageEngineSupplier.get(); ICollection <StorageCommand> commands = new List <StorageCommand>(); TransactionState txState = new TxState(); int tokenId = Math.toIntExact(_idGeneratorFactory.get(_tokenIdType).nextId()); _tokenCreator.createToken(txState, tokenName, tokenId); try { using (StorageReader statement = storageEngine.NewReader()) { storageEngine.CreateCommands(commands, txState, statement, [email protected]_Fields.None, long.MaxValue, NO_DECORATION); } } catch (Exception e) when(e is CreateConstraintFailureException || e is TransactionFailureException || e is ConstraintValidationException) { throw new Exception("Unable to create token '" + tokenName + "'", e); } return(ReplicatedTokenRequestSerializer.CommandBytes(commands)); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Before public void before() throws org.neo4j.internal.kernel.api.exceptions.KernelException //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#: public virtual void Before() { _graphDb = DbRule.GraphDatabaseAPI; CreateAlistairAndStefanNodes(); OrCreateIds; _neoStores = _graphDb.DependencyResolver.resolveDependency(typeof(RecordStorageEngine)).testAccessNeoStores(); _locks = mock(typeof(LockService)); when(_locks.acquireNodeLock(anyLong(), any())).thenAnswer(invocation => { long?nodeId = invocation.getArgument(0); return(_lockMocks.computeIfAbsent(nodeId, k => mock(typeof(Lock)))); }); when(_locks.acquireRelationshipLock(anyLong(), any())).thenAnswer(invocation => { long?nodeId = invocation.getArgument(0); return(_lockMocks.computeIfAbsent(nodeId, k => mock(typeof(Lock)))); }); _storeView = new NeoStoreIndexStoreView(_locks, _neoStores); _reader = new RecordStorageReader(_neoStores); }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes: //ORIGINAL LINE: @Test public void shouldGetAllNodeProperties() public virtual void ShouldGetAllNodeProperties() { // GIVEN string longString = "AlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalongAlalalalalong"; object[] properties = new object[] { longString, CreateNew(typeof(string)), CreateNew(typeof(long)), CreateNew(typeof(int)), CreateNew(typeof(sbyte)), CreateNew(typeof(short)), CreateNew(typeof(bool)), CreateNew(typeof(char)), CreateNew(typeof(float)), CreateNew(typeof(double)), Array(0, typeof(string)), Array(0, typeof(long)), Array(0, typeof(int)), Array(0, typeof(sbyte)), Array(0, typeof(short)), Array(0, typeof(bool)), Array(0, typeof(char)), Array(0, typeof(float)), Array(0, typeof(double)), Array(1, typeof(string)), Array(1, typeof(long)), Array(1, typeof(int)), Array(1, typeof(sbyte)), Array(1, typeof(short)), Array(1, typeof(bool)), Array(1, typeof(char)), Array(1, typeof(float)), Array(1, typeof(double)), Array(256, typeof(string)), Array(256, typeof(long)), Array(256, typeof(int)), Array(256, typeof(sbyte)), Array(256, typeof(short)), Array(256, typeof(bool)), Array(256, typeof(char)), Array(256, typeof(float)), Array(256, typeof(double)) }; foreach (object value in properties) { // given long nodeId = CreateLabeledNode(Db, singletonMap("prop", value), Label1).Id; // when using (StorageNodeCursor node = StorageReader.allocateNodeCursor()) { node.Single(nodeId); assertTrue(node.Next()); using (StoragePropertyCursor props = StorageReader.allocatePropertyCursor()) { props.Init(node.PropertiesReference()); if (props.Next()) { Value propVal = props.PropertyValue(); //then assertTrue(propVal + ".equals(" + value + ")", propVal.Equals(Values.of(value))); } else { fail(); } } } } }
public SingleVNode(TFChunkDb db, SingleVNodeSettings vNodeSettings, SingleVNodeAppSettings appSettings) { Ensure.NotNull(db, "db"); Ensure.NotNull(vNodeSettings, "vNodeSettings"); db.OpenVerifyAndClean(); _tcpEndPoint = vNodeSettings.ExternalTcpEndPoint; _httpEndPoint = vNodeSettings.HttpEndPoint; _outputBus = new InMemoryBus("OutputBus"); _controller = new SingleVNodeController(Bus, _httpEndPoint); _mainQueue = new QueuedHandler(_controller, "MainQueue"); _controller.SetMainQueue(MainQueue); //MONITORING var monitoringInnerBus = new InMemoryBus("MonitoringInnerBus", watchSlowMsg: false); var monitoringRequestBus = new InMemoryBus("MonitoringRequestBus", watchSlowMsg: false); var monitoringQueue = new QueuedHandler(monitoringInnerBus, "MonitoringQueue", watchSlowMsg: true, slowMsgThresholdMs: 100); var monitoring = new MonitoringService(monitoringQueue, monitoringRequestBus, db.Config.WriterCheckpoint, appSettings.StatsPeriod); Bus.Subscribe(monitoringQueue.WidenFrom<SystemMessage.SystemInit, Message>()); Bus.Subscribe(monitoringQueue.WidenFrom<SystemMessage.BecomeShuttingDown, Message>()); monitoringInnerBus.Subscribe<SystemMessage.SystemInit>(monitoring); monitoringInnerBus.Subscribe<SystemMessage.BecomeShuttingDown>(monitoring); monitoringInnerBus.Subscribe<MonitoringMessage.GetFreshStats>(monitoring); //STORAGE SUBSYSTEM var indexPath = Path.Combine(db.Config.Path, "index"); var tableIndex = new TableIndex(indexPath, () => new HashListMemTable(), new InMemoryCheckpoint(), maxSizeForMemory: 1000000, maxTablesPerLevel: 2); var readIndex = new ReadIndex(_mainQueue, db, () => new TFChunkReader(db, db.Config.WriterCheckpoint), TFConsts.ReadIndexReaderCount, db.Config.WriterCheckpoint, tableIndex, new XXHashUnsafe()); var writer = new TFChunkWriter(db); var storageWriter = new StorageWriter(_mainQueue, _outputBus, writer, readIndex); var storageReader = new StorageReader(_mainQueue, _outputBus, readIndex, TFConsts.StorageReaderHandlerCount); monitoringRequestBus.Subscribe<MonitoringMessage.InternalStatsRequest>(storageReader); var chaser = new TFChunkChaser(db, db.Config.WriterCheckpoint, db.Config.GetNamedCheckpoint(Checkpoint.Chaser)); var storageChaser = new StorageChaser(_mainQueue, chaser); _outputBus.Subscribe<SystemMessage.SystemInit>(storageChaser); _outputBus.Subscribe<SystemMessage.SystemStart>(storageChaser); _outputBus.Subscribe<SystemMessage.BecomeShuttingDown>(storageChaser); var storageScavenger = new StorageScavenger(db, readIndex); _outputBus.Subscribe<SystemMessage.ScavengeDatabase>(storageScavenger); //TCP var tcpService = new TcpService(MainQueue, _tcpEndPoint); Bus.Subscribe<SystemMessage.SystemInit>(tcpService); Bus.Subscribe<SystemMessage.SystemStart>(tcpService); Bus.Subscribe<SystemMessage.BecomeShuttingDown>(tcpService); //HTTP HttpService = new HttpService(MainQueue, _httpEndPoint.ToHttpUrl()); Bus.Subscribe<SystemMessage.SystemInit>(HttpService); Bus.Subscribe<SystemMessage.BecomeShuttingDown>(HttpService); Bus.Subscribe<HttpMessage.SendOverHttp>(HttpService); Bus.Subscribe<HttpMessage.UpdatePendingRequests>(HttpService); HttpService.SetupController(new AdminController(MainQueue)); HttpService.SetupController(new PingController()); HttpService.SetupController(new StatController(monitoringQueue)); HttpService.SetupController(new ReadEventDataController(MainQueue)); HttpService.SetupController(new AtomController(MainQueue)); HttpService.SetupController(new WebSiteController(MainQueue)); //REQUEST MANAGEMENT var requestManagement = new RequestManagementService(MainQueue, 1, 1); Bus.Subscribe<ReplicationMessage.EventCommited>(requestManagement); Bus.Subscribe<ReplicationMessage.CreateStreamRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.WriteRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.TransactionStartRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.TransactionWriteRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.TransactionCommitRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.DeleteStreamRequestCreated>(requestManagement); Bus.Subscribe<ReplicationMessage.RequestCompleted>(requestManagement); Bus.Subscribe<ReplicationMessage.CommitAck>(requestManagement); Bus.Subscribe<ReplicationMessage.PrepareAck>(requestManagement); Bus.Subscribe<ReplicationMessage.WrongExpectedVersion>(requestManagement); Bus.Subscribe<ReplicationMessage.InvalidTransaction>(requestManagement); Bus.Subscribe<ReplicationMessage.StreamDeleted>(requestManagement); Bus.Subscribe<ReplicationMessage.PreparePhaseTimeout>(requestManagement); Bus.Subscribe<ReplicationMessage.CommitPhaseTimeout>(requestManagement); var clientService = new ClientService(); Bus.Subscribe<TcpMessage.ConnectionClosed>(clientService); Bus.Subscribe<ClientMessage.SubscribeToStream>(clientService); Bus.Subscribe<ClientMessage.UnsubscribeFromStream>(clientService); Bus.Subscribe<ClientMessage.SubscribeToAllStreams>(clientService); Bus.Subscribe<ClientMessage.UnsubscribeFromAllStreams>(clientService); Bus.Subscribe<ReplicationMessage.EventCommited>(clientService); //TIMER //var timer = new TimerService(new TimerBasedScheduler(new RealTimer(), new RealTimeProvider())); TimerService = new TimerService(new ThreadBasedScheduler(new RealTimeProvider())); Bus.Subscribe<TimerMessage.Schedule>(TimerService); MainQueue.Start(); monitoringQueue.Start(); }
public PBDataReader(byte[] bt, int pos, int size) { _storage = new StorageReader(bt, pos, size); }
public void Write(Action<StorageActionsAccessor> func) { lock (locker) { using (var reader = OpenReader()) { var mutator = new StorageMutator(writer, reader, transaction); var viewer = new StorageReader(reader, transaction); var accessor = new StorageActionsAccessor(mutator, viewer, reader, writer); func(accessor); mutator.Flush(); var storageTransaction = mutator.CreateTransaction(); if (transaction.Equals(storageTransaction)) return; WriteTransaction(storageTransaction); writer.Flush(true); transaction = storageTransaction; accessor.RaiseCommitEvent(); if (onCommit != null) onCommit(); } } }
internal ClientProtocol(Connection dtc) : base(dtc) { _packet = new PacketHeader(); _output = new StorageWriter(null); _source = new StorageReader(null); }
public JSDataReader(DataStorage ds) { _storage = new StorageReader(ds); }
public JSDataReader(byte[] dt, int pos, int size) { _storage = new StorageReader(dt, pos, size); }