예제 #1
0
        // Statically generate default instance to speed up further invocations

        // private static IManagedFAST<BlittableKey, BlittableValue, BlittableInput, BlittableOutput, BlittableContext>
        // dummyToGetCodeGenFaster = HashTableManager.GetManagedFasterHashTable<BlittableKey, BlittableValue, BlittableInput, BlittableOutput, BlittableContext, UserFunctions>(128, new NullDevice(), new UserFunctions(), false);
        // static FASTERFactory()
        // {
        //    if (dummyToGetCodeGenFaster == null) throw new Exception();
        // }

        public static IDevice CreateLogDevice(string logPath, long segmentSize = 1L << 30)
        {
            IDevice logDevice = new NullDevice();

            if (!String.IsNullOrWhiteSpace(logPath))
            {
                logDevice = new WrappedDevice(new SegmentedLocalStorageDevice(logPath, segmentSize, false, false, true, false));
            }

            return(logDevice);
        }
예제 #2
0
        /// <summary>
        /// Create a storage device for the object log (for non-blittable objects)
        /// </summary>
        /// <param name="logPath">Path to file that will store the log (empty for null device)</param>
        /// <param name="preallocateFile">Whether we try to preallocate the file on creation</param>
        /// <param name="deleteOnClose">Delete files on close</param>
        /// <returns>Device instance</returns>
        public static IDevice CreateObjectLogDevice(string logPath, bool preallocateFile = true, bool deleteOnClose = false)
        {
            IDevice logDevice = new NullDevice();

            if (String.IsNullOrWhiteSpace(logPath))
            {
                return(logDevice);
            }
#if DOTNETCORE
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                logDevice = new ManagedLocalStorageDevice(logPath + ".obj.log", preallocateFile, deleteOnClose);
            }
            else
#endif
            {
                logDevice = new LocalStorageDevice(logPath + ".obj.log", preallocateFile, deleteOnClose);
            }
            return(logDevice);
        }
예제 #3
0
        /// <summary>
        /// Create a storage device for the log
        /// </summary>
        /// <param name="logPath">Path to file that will store the log (empty for null device)</param>
        /// <param name="segmentSize">Size of each chunk of the log</param>
        /// <param name="deleteOnClose">Delete files on close</param>
        /// <returns>Device instance</returns>
        public static IDevice CreateLogDevice(string logPath, long segmentSize = 1L << 30, bool deleteOnClose = false)
        {
            IDevice logDevice = new NullDevice();

            if (String.IsNullOrWhiteSpace(logPath))
            {
                return(logDevice);
            }
#if DOTNETCORE
            if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                logDevice = new ManagedLocalStorageDevice(logPath + ".log", segmentSize, true, false, deleteOnClose);
            }
#else
            {
                logDevice = new LocalStorageDevice(logPath + ".log", segmentSize, true, false, deleteOnClose);
            }
#endif
            return(logDevice);
        }