aumcode / nfx

C# Server UNISTACK framework [MOVED]
https://github.com/agnicore/nfx
Other
391 stars 93 forks source link

Add Pile.Put(PilePointer) to overwrite exisitng pointer, prealloc buffer + linking #53

Closed itadapter closed 7 years ago

itadapter commented 7 years ago

Something akin to:

    /// <summary>
    /// Tries to put the new object over an existing one at the pre-define position.
    /// The pointer has to reference a valid allocated block.
    /// If object fits in the allocated block returns true, otherwise tries to create an internal link
    /// to the new pointer which is completely transparent to the caller. The linking may be exlicitly disabled
    /// in which case the method returns false when the new object does not fit into the existing block
    /// </summary>
    /// <param name="obj">A new/modified CLR object to put into the Pile over an existing one</param>
    /// <param name="lifeSpanSec">
    ///  Optional lifeSpanSec will auto-delete object after the interval elapses if
    ///  the pile SupportsObjectExpiration and SweepExpiredObjects is set to true
    /// </param>
    /// <param name="ptr">The pointer to the existing valid allocated block</param>
    /// <param name="link">False to prohibit internal pointer linking</param>
    /// <returns>True if object was inserted, false otherwise (i.e. when linking is false)</returns>
    bool Put(PilePointer ptr, object obj, uint lifeSpanSec = 0, bool link = true);
itadapter commented 7 years ago

done, in testing 829b4a8

itadapter commented 7 years ago

Passing tests. Closing.