public ObjectKey(DataFile file, string name = null, object obj = null) { Name = name; this.obj = obj; if (file != null) { CompressionMethod = file.CompressionMethod; CompressionLevel = file.CompressionLevel; Init(file); } }
public DataFile GetFile(string name, FileMode mode = FileMode.OpenOrCreate) { lock (this) { var dataFile = GetFromCache(name); if (dataFile == null) { Console.WriteLine($"{DateTime.Now} Opening file : {name}"); dataFile = new DataFile(Path.Combine(this.path, name), this.smanager); dataFile.Open(mode); this.dataFiles.Add(name, dataFile); } return(dataFile); } }
internal void Init(DataFile file, ObjectKey key) { lock (Sync) { this.file = file; this.key = key; key.CompressionLevel = 0; key.CompressionMethod = 0; // Init dataKey list if (this.cachePosition == -1) { this.cache = new IdArray <DataKey>(Math.Max(4096, this.bufferCount)); this.cacheKey = new ObjectKey(file, "", new DataKeyIdArray(this.cache)); } } }
public void Init(DataFile file) { this.file = file; if (this.obj != null) { ObjectStreamer streamer; file.StreamerManager.Get(this.obj.GetType(), out streamer); if (streamer != null) { TypeId = streamer.TypeId; } else { Console.WriteLine($"ObjectKey::Init Can not find streamer for object of type {this.obj.GetType()}"); } } }
public FilePortfolioServer(Framework framework, string fileName, string host = null, int port = -1) : base(framework) { this.host = host; this.port = port; this.dataFile = host == null? new DataFile(fileName, framework.StreamerManager): new NetDataFile(fileName, host, port, framework.StreamerManager); }
public FileDataServer(Framework framework, string fileName, string host = null, int port = -1) : base(framework) { this.host = host; this.dataFile = new DataFile(fileName, framework.StreamerManager); }
public FreeKey(DataFile dataFile, long position = -1, int size = -1) { this.file = dataFile; this.position = position; this.length = size; }