/// <summary> /// NodeCursor should only see changes that are there from the beginning /// otherwise it will not be stable. /// </summary> private bool HasChanges() { switch (_hasChanges) { case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.Maybe: bool changes = _read.hasTxStateWithChanges(); if (changes) { if (_single != NO_ID) { _addedNodes = _read.txState().nodeIsAddedInThisTx(_single) ? LongSets.immutable.of(_single).longIterator() : ImmutableEmptyLongIterator.INSTANCE; } else { _addedNodes = _read.txState().addedAndRemovedNodes().Added.freeze().longIterator(); } _hasChanges = HasChanges.Yes; } else { _hasChanges = HasChanges.No; } return(changes); case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.Yes: return(true); case Org.Neo4j.Kernel.Impl.Newapi.HasChanges.No: return(false); default: throw new System.InvalidOperationException("Style guide, why are you making me do this"); } }
internal virtual void Single(long reference, Read read) { _storeCursor.single(reference); this._read = read; this._single = reference; this._hasChanges = HasChanges.Maybe; this._addedNodes = ImmutableEmptyLongIterator.INSTANCE; }
internal virtual void Scan(Read read) { _storeCursor.scan(); this._read = read; this._single = NO_ID; this._hasChanges = HasChanges.Maybe; this._addedNodes = ImmutableEmptyLongIterator.INSTANCE; }
/// <summary> /// can throw exception in case of error /// </summary> private void PerformSave(string fileName) { using (var file = File.Create(fileName)) { Config.SaveXml(file); } // succeeded FilePathName.SetValue(fileName); FilePathValid.SetValue(true); HasChanges.SetValue(false); }
public override void Close() { if (!Closed) { _read = null; _hasChanges = HasChanges.Maybe; _addedNodes = ImmutableEmptyLongIterator.INSTANCE; _storeCursor.reset(); _pool.accept(this); } }
private void DoNew() { if (!CanDiscardOldData("Create New Configuration")) { return; } Config.Reset(); FilePathName.SetValue(FileNameNew); FilePathValid.SetValue(false); HasChanges.SetValue(false); }
/// <summary> /// can throw exception in case of error /// </summary> private void PerformOpen(string fileName) { try { using (var file = File.OpenRead(fileName)) { Config.ReadXml(file); } } catch (Exception) { Config.Reset(); throw; } // succeeded FilePathName.SetValue(fileName); FilePathValid.SetValue(true); HasChanges.SetValue(false); }