Example #1
0
 private static bool CheckSynced(PCache cache)
 {
     PgHdr p;
     for (p = cache.DirtyTail; p != cache.Synced; p = p.DirtyPrev)
         Debug.Assert(p.Refs != 0 || (p.Flags & PgHdr.PGHDR.NEED_SYNC) != 0);
     return (p == null || p.Refs != 0 || (p.Flags & PgHdr.PGHDR.NEED_SYNC) == 0);
 }
Example #2
0
        private static bool CheckSynced(PCache cache)
        {
            PgHdr p;

            for (p = cache.DirtyTail; p != cache.Synced; p = p.DirtyPrev)
            {
                Debug.Assert(p.Refs != 0 || (p.Flags & PgHdr.PGHDR.NEED_SYNC) != 0);
            }
            return(p == null || p.Refs != 0 || (p.Flags & PgHdr.PGHDR.NEED_SYNC) == 0);
        }
Example #3
0
        public static void Move(PgHdr p, Pid newID)
        {
            PCache cache = p.Cache;

            Debug.Assert(p.Refs > 0);
            Debug.Assert(newID > 0);
            cache.Cache.Rekey(p.Page, p.ID, newID);
            p.ID = newID;
            if ((p.Flags & PgHdr.PGHDR.DIRTY) != 0 && (p.Flags & PgHdr.PGHDR.NEED_SYNC) != 0)
            {
                RemoveFromDirtyList(p);
                AddToDirtyList(p);
            }
        }
Example #4
0
        //public static implicit operator bool(PgHdr b) { return (b != null); }

        public void memset()
        {
            //Page = null;
            Data  = null;
            Extra = null;
            Dirty = null;
            Pager = null;
            ID    = 0;
#if CHECK_PAGES
            PageHash = 0;
#endif
            Flags     = 0;
            Refs      = 0;
            Cache     = null;
            DirtyNext = null;
            DirtyPrev = null;
        }
Example #5
0
 //public static int SizeOf()
 //{
 //    return 4;
 //}
 public static void Open(int sizePage, int sizeExtra, bool purgeable, Func<object, PgHdr, RC> stress, object stressArg, PCache p)
 {
     p.memset();
     p.SizePage = sizePage;
     p.SizeExtra = sizeExtra;
     p.Purgeable = purgeable;
     p.Stress = stress;
     p.StressArg = stressArg;
     p.SizeCache = 100;
 }
Example #6
0
        //public static int SizeOf()
        //{
        //    return 4;
        //}

        public static void Open(int sizePage, int sizeExtra, bool purgeable, Func <object, PgHdr, RC> stress, object stressArg, PCache p)
        {
            p.memset();
            p.SizePage  = sizePage;
            p.SizeExtra = sizeExtra;
            p.Purgeable = purgeable;
            p.Stress    = stress;
            p.StressArg = stressArg;
            p.SizeCache = 100;
        }
Example #7
0
 //public static implicit operator bool(PgHdr b) { return (b != null); }
 public void memset()
 {
     //Page = null;
     Data = null;
     Extra = null;
     Dirty = null;
     Pager = null;
     ID = 0;
     #if CHECK_PAGES
     PageHash = 0;
     #endif
     Flags = 0;
     Refs = 0;
     Cache = null;
     DirtyNext = null;
     DirtyPrev = null;
 }