protected ExtractedItem(Tombstone tombstone, string collection, EtlItemType type) { Etag = tombstone.Etag; switch (type) { case EtlItemType.Document: Debug.Assert(tombstone.Type == Tombstone.TombstoneType.Document || tombstone.Type == Tombstone.TombstoneType.Attachment); DocumentId = tombstone.LowerId; Collection = collection; break; case EtlItemType.Counter: Debug.Assert(tombstone.Type == Tombstone.TombstoneType.Counter); Collection = tombstone.Collection; CounterTombstoneId = tombstone.LowerId; break; } IsDelete = true; ChangeVector = tombstone.ChangeVector; Type = type; if (Collection == null) { CollectionFromMetadata = tombstone.Collection; } }
public override void HandleDelete(Tombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { if (_referencedCollections.Count > 0) _handleReferences.HandleDelete(tombstone, collection, writer, indexContext, stats); base.HandleDelete(tombstone, collection, writer, indexContext, stats); }
public RavenEtlItem(Tombstone tombstone, string collection, EtlItemType type) : base(tombstone, collection, type) { if (tombstone.Type == Tombstone.TombstoneType.Attachment) { AttachmentTombstoneId = tombstone.LowerId; } }
public async ValueTask WriteTombstoneAsync(Tombstone tombstone, SmugglerProgressBase.CountsWithLastEtag progress) { if (First == false) { Writer.WriteComma(); } First = false; using (tombstone) { _context.Write(Writer, new DynamicJsonValue { ["Key"] = tombstone.LowerId, [nameof(Tombstone.Type)] = tombstone.Type.ToString(), [nameof(Tombstone.Collection)] = tombstone.Collection, [nameof(Tombstone.Flags)] = tombstone.Flags.ToString(), [nameof(Tombstone.ChangeVector)] = tombstone.ChangeVector, [nameof(Tombstone.DeletedEtag)] = tombstone.DeletedEtag, [nameof(Tombstone.Etag)] = tombstone.Etag, [nameof(Tombstone.LastModified)] = tombstone.LastModified, }); await Writer.MaybeFlushAsync(); } }
public virtual async Task <Tombstone> Die() { Tombstone tombstone = null; if (isUsed) { var pos = transform.position.WorldToArray(); if (array[pos.x][pos.y] == this) { array[pos.x][pos.y] = null; } army.units.Remove(this); transform.parent = null; gameObject.SetActive(false); tombstone = Tombstone.NewOrUpdate(transform.position); R.pool.Show(ObjectPool.POOL_KEY.BLUE_FIRE, transform.position); R.pool.Show(ObjectPool.POOL_KEY.EXPLOSION_SMOKE, transform.position); R.onDie?.Invoke(this); await Task.Delay(600); R.pool.Hide(ObjectPool.POOL_KEY.BLUE_FIRE); R.pool.Hide(ObjectPool.POOL_KEY.EXPLOSION_SMOKE); } Destroy(gameObject); return(tombstone); }
internal void OnSummonPerformed(Vector3 position, float radius, float summonHP) { // find all tombstones within radius! Collider2D[] hitColliders = Physics2D.OverlapCircleAll(position, radius); int i = 0; while (i < hitColliders.Length) { Tombstone tomb = hitColliders[i].GetComponent <Tombstone>(); if (tomb != null) { tomb.OnRessurect(summonHP); } else { Bones bones = hitColliders[i].GetComponent <Bones>(); if (bones) { bones.OnResurrect(summonHP); } } i++; } }
public static ReplicationBatchItem From(Tombstone doc) { var item = new ReplicationBatchItem { Etag = doc.Etag, Id = doc.LowerId, TransactionMarker = doc.TransactionMarker, ChangeVector = doc.ChangeVector }; switch (doc.Type) { case Tombstone.TombstoneType.Document: item.Type = ReplicationItemType.DocumentTombstone; item.Collection = doc.Collection; item.Flags = doc.Flags; item.LastModifiedTicks = doc.LastModified.Ticks; break; case Tombstone.TombstoneType.Attachment: item.Type = ReplicationItemType.AttachmentTombstone; break; case Tombstone.TombstoneType.Revision: item.Type = ReplicationItemType.RevisionTombstone; item.Collection = doc.Collection; break; default: throw new ArgumentOutOfRangeException(nameof(doc.Type)); } return(item); }
public unsafe void HandleDelete(Tombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { var tx = indexContext.Transaction.InnerTransaction; var loweredKey = tombstone.LowerId; using (Slice.External(tx.Allocator, loweredKey, out Slice tombstoneKeySlice)) _indexStorage.RemoveReferences(tombstoneKeySlice, collection, null, indexContext.Transaction); }
public void WriteTombstone(Tombstone tombstone, SmugglerProgressBase.CountsWithLastEtag progress) { _command.Add(new DocumentItem { Tombstone = tombstone }); HandleBatchOfDocumentsIfNecessary(); }
public override void Paint(Level level) { base.Paint(level); var tomb = new Tombstone(); tomb.Item = GlobalSave.GetString("next_tomb") ?? "bk:coin"; GlobalSave.Put("tomb_depth", 0); level.Area.Add(tomb); tomb.Center = GetCenter() * 16 + new Vector2(8); }
public override void Update(float dt) { base.Update(dt); var with = GetComponent <InteractableComponent>().CurrentlyInteracting; if (with == null) { return; } foreach (var gamepad in Input.Gamepads) { if (gamepad.AnythingIsDown() && !gamepad.AnythingIsDown(gamepad.PreviousState)) { var index = ((int)gamepad.PlayerIndex) + 1; var found = false; foreach (var p in Area.Tagged[Tags.Player]) { var i = p.GetComponent <InputComponent>(); if (i.Index == index) { found = true; break; } } if (found) { continue; } foreach (var p in Area.Tagged[Tags.Player]) { var i = p.GetComponent <InputComponent>(); if (i.Index == 0 && i.KeyboardEnabled) { i.GamepadEnabled = false; break; } } with.GetComponent <InteractorComponent>().EndInteraction(); Tombstone.CreatePlayer(Area, (byte)index, true, with.BottomCenter + new Vector2(0, 2)); break; } } }
protected ExtractedItem(Tombstone tombstone, string collection) { Etag = tombstone.Etag; DocumentId = tombstone.LowerId; IsDelete = true; Collection = collection; ChangeVector = tombstone.ChangeVector; if (collection == null) { CollectionFromMetadata = tombstone.Collection; } }
// Use this for initialization void Start() { isBreakable = (this.tag == "Breakable"); // Tracking breakables if (isBreakable) { breakableCount++; } timesHit = 0; levelManager = GameObject.FindObjectOfType <LevelManager>(); tombstone = GameObject.FindObjectOfType <Tombstone>(); }
/// <summary> /// Called when simulation is about to destroy itself, but right before it actually does it. /// </summary> protected override void OnPreDestroy() { // Notify modules of impending doom allowing them to save data. Scoring.Destroy(); Tombstone.Destroy(); Time.Destroy(); EventDirector.Destroy(); Trail.Destroy(); // Null the destroyed instances. Scoring = null; Tombstone = null; Time = null; EventDirector = null; Trail = null; TotalTurns = 0; Vehicle = null; // Destroys game simulation instance. Instance = null; }
internal bool TryCreateTombstoneBatch(DocumentSessionBase session, out UpdateBatch batch) { if (session.UnitOfWork.Streams.Any()) { var stream = StreamAction.ForTombstone(); var tombstone = new Tombstone(); var mapping = EventMappingFor <Tombstone>(); var operations = new List <IStorageOperation>(); var storage = session.EventStorage(); var dotNetTypeName = DotnetTypeNameFor(typeof(Tombstone)); operations.Add(_establishTombstone.Value); var tombstones = session.UnitOfWork.Streams .SelectMany(x => x.Events) .Select(x => new Event <Tombstone>(tombstone) { Sequence = x.Sequence, Version = x.Version, TenantId = x.TenantId, StreamId = EstablishTombstoneStream.StreamId, StreamKey = EstablishTombstoneStream.StreamKey, Id = CombGuidIdGeneration.NewGuid(), EventTypeName = mapping.EventTypeName, DotNetTypeName = dotNetTypeName }) .Select(e => storage.AppendEvent(this, session, stream, e)); operations.AddRange(tombstones); batch = new UpdateBatch(operations); return(true); } batch = null; return(false); }
public override void Remove(K key) { // Get the hashcode int iInitialHash = HashFunction(key); // Current location we are looking at in the collision chain int iCurrentLocation = iInitialHash; // How many attempts were made to increment int iAttempts = 1; // Indicator that the item was found Boolean found = false; while (!found && oDataArray[iCurrentLocation] != null) { // If the current location contains a key-value if (oDataArray[iCurrentLocation].GetType() == typeof(KeyValue <K, V>)) { // It is a key-value KeyValue <K, V> kv = (KeyValue <K, V>)oDataArray[iCurrentLocation]; // Check if it is the key-value we are looking for if (kv.Key.CompareTo(key) == 0) { oDataArray[iCurrentLocation] = new Tombstone(); found = true; iCount--; } } // Increment to the next location iCurrentLocation = iInitialHash + GetIncrement(iAttempts, key); iCurrentLocation %= HTSize; } if (!found) { throw new KeyNotFoundException("Key not found"); } }
public GameObject Create(string name, float distance, string date) { //Debug.Log("TombstoneFactory.Create(" + name + ", " + distance + ", " + date + ")"); Vector3 pos = new Vector3(distance, 0, Random.Range(Z_MIN, Z_MAX)); float height = terrain.SampleHeight(pos); pos.y = height; GameObject tombstone = Instantiate(prefab, pos, Quaternion.identity); //tombstone.GetComponent<Tombstone>().Set(name, distance, epitath, date); Tombstone t = tombstone.GetComponent <Tombstone>(); if (t != null) { t.Set(name, distance, date); } else { tombstone.GetComponent <TombstoneTMP>().Set(name, distance, date); } return(tombstone); }
public override unsafe void HandleDelete(Tombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { using (Slice.External(indexContext.Allocator, tombstone.LowerId.Buffer, tombstone.LowerId.Length, out Slice docKeyAsSlice)) { MapReduceWorkContext.DocumentMapEntries.RepurposeInstance(docKeyAsSlice, clone: false); if (MapReduceWorkContext.DocumentMapEntries.NumberOfEntries == 0) { return; } foreach (var mapEntry in GetMapEntries(MapReduceWorkContext.DocumentMapEntries)) { var store = GetResultsStore(mapEntry.ReduceKeyHash, indexContext, create: false); store.Delete(mapEntry.Id); } MapReduceWorkContext.MapPhaseTree.DeleteFixedTreeFor(tombstone.LowerId, sizeof(ulong)); } }
public override void Remove(K key) { int iAttempt = 1; int iInitialHash = HashFunction(key); int iCurrentLocation = iInitialHash; bool bFound = false; KeyValue <K, V> kvKey = new KeyValue <K, V>(key, default(V)); while (!bFound && oDataArray[iCurrentLocation] != null) { //If location contains a KeyValue if (oDataArray[iCurrentLocation].GetType() == typeof(KeyValue <K, V>)) { //Check the current key-value to make sure it's not the same as the key-value being added KeyValue <K, V> kv = (KeyValue <K, V>)oDataArray[iCurrentLocation]; //if(kv.Key.CompareTo(key)==0) if (kv.Equals(kvKey)) { oDataArray[iCurrentLocation] = new Tombstone(); bFound = true; //Decrement the count iCount--; } } iCurrentLocation = iInitialHash + GetIncrement(iAttempt++, key); //Loop back to the top of the table if we go beyond the table iCurrentLocation %= HTSize; } if (!bFound) { throw new ApplicationException(key + " was not found"); } }
public override void Remove(K key) { // Get the hashcode (the key of the object passed in) int iInitialHash = HashFunction(key); // Current location we are looking at in the collision chain int iCurrentLocation = iInitialHash; // How many attempts were made to increment //int iAttempts = 1; BST <KeyValue <K, V> > bst = null; // if key exist at current location if (oDataArray[iCurrentLocation] != null && oDataArray[iCurrentLocation].GetType() == typeof(BST <KeyValue <K, V> >)) { // planning on having this loop through every node in the bst, to try and remove the node bst = (BST <KeyValue <K, V> >)oDataArray[iCurrentLocation]; //Console.WriteLine(Get(key)); V value = Get(key); KeyValue <K, V> kvNew = new KeyValue <K, V>(key, value); IterateTree(bst); if (bst.Remove(kvNew) && qNodes.Count == 1) { oDataArray[iCurrentLocation] = new Tombstone(); } } else { // otherwise throw an exception telling the user it doesn't exist throw new KeyNotFoundException("Key to remove does not exist in the Hash Table"); } }
public override void HandleDelete(Tombstone tombstone, string collection, Lazy <IndexWriteOperation> writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { throw new NotSupportedException($"Index {Name} is in-memory implementation of a faulty index", _e); }
public override void HandleDelete(Tombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { StaticIndexHelper.HandleReferencesDelete(_handleReferences, _handleCompareExchangeReferences, tombstone, collection, writer, indexContext, stats); base.HandleDelete(tombstone, collection, writer, indexContext, stats); }
public override void HandleDelete(Tombstone tombstone, string collection, Lazy <IndexWriteOperation> writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { using (DocumentIdWorker.GetSliceFromId(indexContext, tombstone.LowerId, out Slice documentIdPrefixWithTsKeySeparator, SpecialChars.RecordSeparator)) _referencesStorage.RemoveReferencesByPrefix(documentIdPrefixWithTsKeySeparator, collection, null, indexContext.Transaction); }
public override void HandleDelete(Tombstone tombstone, string collection, IndexWriteOperation writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { throw new NotImplementedException(); }
public override void HandleDelete(Tombstone tombstone, string collection, Lazy <IndexWriteOperation> writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { StaticIndexHelper.HandleDeleteBySourceDocumentId(this, _handleReferences, _handleCompareExchangeReferences, tombstone, collection, writer, indexContext, stats); }
public static void AddTombstone(Tombstone tombstone) { tombstones = tombstones == null ? new ArrayList() : tombstones; tombstones.Add(tombstone); }
private IEnumerable <Tombstone> ReadTombstones(INewDocumentActions actions = null) { if (UnmanagedJsonParserHelper.Read(_peepingTomStream, _parser, _state, _buffer) == false) { UnmanagedJsonParserHelper.ThrowInvalidJson("Unexpected end of json", _peepingTomStream, _parser); } if (_state.CurrentTokenType != JsonParserToken.StartArray) { UnmanagedJsonParserHelper.ThrowInvalidJson("Expected start array, but got " + _state.CurrentTokenType, _peepingTomStream, _parser); } var context = _context; var builder = CreateBuilder(context, null); try { while (true) { if (UnmanagedJsonParserHelper.Read(_peepingTomStream, _parser, _state, _buffer) == false) { UnmanagedJsonParserHelper.ThrowInvalidJson("Unexpected end of json while reading docs", _peepingTomStream, _parser); } if (_state.CurrentTokenType == JsonParserToken.EndArray) { break; } if (actions != null) { var oldContext = context; context = actions.GetContextForNewDocument(); if (oldContext != context) { builder.Dispose(); builder = CreateBuilder(context, null); } } builder.Renew("import/object", BlittableJsonDocumentBuilder.UsageMode.ToDisk); _context.CachedProperties.NewDocument(); ReadObject(builder); var data = builder.CreateReader(); builder.Reset(); var tombstone = new Tombstone(); if (data.TryGet("Key", out tombstone.LowerId) && data.TryGet(nameof(Tombstone.Type), out string type) && data.TryGet(nameof(Tombstone.Collection), out tombstone.Collection) && data.TryGet(nameof(Tombstone.LastModified), out tombstone.LastModified)) { if (Enum.TryParse <Tombstone.TombstoneType>(type, out var tombstoneType) == false) { var msg = $"Ignoring a tombstone of type `{type}` which is not supported in 4.0. "; if (_log.IsOperationsEnabled) { _log.Operations(msg); } _result.Tombstones.ErroredCount++; _result.AddWarning(msg); continue; } tombstone.Type = tombstoneType; yield return(tombstone); } else { var msg = "Ignoring an invalid tombstone which you try to import. " + data; if (_log.IsOperationsEnabled) { _log.Operations(msg); } _result.Tombstones.ErroredCount++; _result.AddWarning(msg); } } } finally { builder.Dispose(); } }
public static void HandleDeleteBySourceDocumentId(MapReduceIndex index, HandleReferences handleReferences, HandleCompareExchangeReferences handleCompareExchangeReferences, Tombstone tombstone, string collection, Lazy <IndexWriteOperation> writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { HandleReferencesDelete(handleReferences, handleCompareExchangeReferences, tombstone, collection, writer, indexContext, stats); using (ToPrefixKey(tombstone.LowerId, indexContext, out var prefixKey)) { var toDelete = new List <Slice>(); using (var it = index.MapReduceWorkContext.MapPhaseTree.Iterate(prefetch: false)) { it.SetRequiredPrefix(prefixKey); if (it.Seek(prefixKey) == false) { return; } do { toDelete.Add(it.CurrentKey.Clone(indexContext.Allocator)); } while (it.MoveNext()); } foreach (var key in toDelete) { index.MapReduceWorkContext.DocumentMapEntries.RepurposeInstance(key, clone: false); if (index.MapReduceWorkContext.DocumentMapEntries.NumberOfEntries == 0) { continue; } foreach (var mapEntry in MapReduceIndex.GetMapEntries(index.MapReduceWorkContext.DocumentMapEntries)) { var store = index.GetResultsStore(mapEntry.ReduceKeyHash, indexContext, create: false); store.Delete(mapEntry.Id); } index.MapReduceWorkContext.MapPhaseTree.DeleteFixedTreeFor(key, sizeof(ulong)); } }
// Create the tombstone on the map. private void CreateTombstone(Tombstone tombstone) { GameObject obj = Instantiate(tombstoneObject); obj.transform.position = new Vector3(tombstone.x, tombstone.y, 0.0f); }
public override void HandleDelete(Tombstone tombstone, string collection, Lazy <IndexWriteOperation> writer, TransactionOperationContext indexContext, IndexingStatsScope stats) { writer.Value.Delete(tombstone.LowerId, stats); }
public ElasticSearchItem(Tombstone tombstone, string collection) : base(tombstone, collection, EtlItemType.Document) { }