Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a new page head. The page head handles page locks and versions
        /// </summary>
        /// <param name="pageNumber">The page number of the page</param>
        /// <param name="page">The current version of the page from storage</param>
        public PageHead(ulong pageNumber, IPage page)
        {
            PageNumber = pageNumber;
            Versions   = new OwinContainers.LinkedList <PageVersion>();

            var pageVersion = new PageVersion(0, page);

            pageVersion.Added(this, Versions.Append(pageVersion));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Adds a new version of this page
        /// </summary>
        public PageVersion AddVersion(PageVersion pageVersion)
        {
            lock (Versions)
            {
                var nextVersion = Versions.FirstElementOrDefault(v => v.VersionNumber >= pageVersion.VersionNumber);
                pageVersion.Added(this, Versions.InsertBefore(nextVersion, pageVersion));
            }

            return(pageVersion);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Appends a page to this database version. This PageVersion will
 /// be disposed when the PageVersion is disposed.
 /// </summary>
 public void AddPage(PageVersion pageVersion)
 {
     _pageVersions.Append(pageVersion);
 }