Ejemplo n.º 1
0
        // ugly but does the job
        private static FileSystemPath FindEntitySubfolder(object key, FilesystemStorageOptions options)
        {
            var step = options.EntitiesPerDirectory;
            var root = options.BasePath;

            switch (key)
            {
            case byte b: return(root.Partition(b, step));

            case short s: return(root.Partition(s, step));

            case int i: return(root.Partition(i, step));

            case long l: return(root.Partition(l, step));

#if !CLS
            case sbyte sb: return(root.Partition(sb, step));

            case ushort us: return(root.Partition(us, step));

            case uint ui: return(root.Partition(ui, step));

            case ulong ul: return(root.Partition(ul, step));
#endif
            default: return(root.AppendDirectory(key.GetHashCode().ToString()));
            }
        }
Ejemplo n.º 2
0
 public static FileSystemPath LocateKeyFile(object key, FilesystemStorageOptions options)
 {
     return(FindEntitySubfolder(key, options).AppendFile(KeyFilename));
 }
Ejemplo n.º 3
0
 public static FileSystemPath FindSnapshotFolder(object key, FilesystemStorageOptions options)
 {
     return(FindEntitySubfolder(key, options).AppendDirectory(SnapshotSubfolder));
 }
Ejemplo n.º 4
0
 public FilesystemEntityReaderWriter(
     IFileSystem filesystem,
     IFormatter <TInput, TOutput> formatter,
     FilesystemStorageOptions options)
 =>
 (this.filesystem, this.formatter, this.options) =