// Если файл большой, то не будет осуществляться запрос к второй таблице и размер будет 0 private Stat GetShortStat(CQLFile file) => new Stat() { st_nlink = 1, st_mode = (FilePermissions)file.FilePermissions, st_size = file.Data?.LongLength ?? 0, st_blocks = file.Data?.LongLength / 512 ?? 0, st_blksize = file.Data?.LongLength ?? 0, // Optimal size for buffer in I/O operations st_atim = DateTimeOffset.Now.ToTimespec(), // access st_mtim = file.ModifiedTimestamp.ToTimespec(), // modified st_gid = (uint)file.GID, st_uid = (uint)file.UID, };
private FileModel GetFileModel(CQLFile file) => file == null ? null : new FileModel { Path = file.Path, Name = file.Name, Data = file.Data, ModifiedTimestamp = file.ModifiedTimestamp, ExtendedAttributes = FileExtendedAttributesHandler.DeserializeExtendedAttributes(file.ExtendedAttributes), FilePermissions = (FilePermissions)file.FilePermissions, GID = (uint)file.GID, UID = (uint)file.UID, ContentGUID = file.ContentGuid };
private CQLFile GetCQLFile(FileModel file) { var cqlFile = new CQLFile { Path = file.Path, Name = file.Name, ExtendedAttributes = FileExtendedAttributesHandler.SerializeExtendedAttributes(file.ExtendedAttributes), ModifiedTimestamp = file.ModifiedTimestamp, FilePermissions = (int)file.FilePermissions, GID = file.GID, UID = file.UID }; if (file.Data.Length > dataBufferSize) { cqlFile.ContentGuid = file.ContentGUID ?? Guid.NewGuid(); } else { cqlFile.Data = file.Data; } return(cqlFile); }