Issued by the VersionList static class to writers, telling them which version number to use when writing, and allwing them to report changes they make back to the VersionList.
Inheritance: ReadTicket
Exemplo n.º 1
0
        /// <summary>
        /// Called after a thread checked and can commit. This will assign it a
        /// unique stamp to use for writing. This method will enter the new stamp
        /// into the stamp.Version. It must be done here to guarantee that no
        /// GetReaderTicket will return your stamp number before it has been
        /// written into your stamp lock! After completing your write, place your
        /// changes into the ticket, and this class will trim the old versions at
        /// the correct time. It is critical that this be done, which is why this
        /// method returns it as an out param - to make sure no exception can
        /// cause us to lose the ref to the ticket, if it is already in the chain.
        /// </summary>
        public static void NewVersion(WriteStamp stamp, out WriteTicket ticket)
        {
            // this version is running under the _checkLock, guaranteed to be alone!
            var newNode = new VersionEntry();

            ticket = newNode;

            var newStamp = _current.Stamp + 1;

            newNode.SetStamp(newStamp);
            stamp.Version  = newStamp;
            _current.Later = newNode;
            _current       = newNode;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Called after a thread checked and can commit. This will assign it a
        /// unique stamp to use for writing. This method will enter the new stamp
        /// into the stamp.Version. It must be done here to guarantee that no
        /// GetReaderTicket will return your stamp number before it has been
        /// written into your stamp lock! After completing your write, place your
        /// changes into the ticket, and this class will trim the old versions at
        /// the correct time. It is critical that this be done, which is why this
        /// method returns it as an out param - to make sure no exception can
        /// cause us to lose the ref to the ticket, if it is already in the chain.
        /// </summary>
        public static void NewVersion(WriteStamp stamp, out WriteTicket ticket)
        {
            // this version is running under the _checkLock, guaranteed to be alone!
            var newNode = new VersionEntry();
            ticket = newNode;

            var newStamp = _current.Stamp + 1;
            newNode.SetStamp(newStamp);
            stamp.Version = newStamp;
            _current.Later = newNode;
            _current = newNode;
        }