public void RegisterSnapshot(int scopeId, AssetStorages.Storage storage) { // duplicates are not allowed, there can be multiple snapshots to same solution, so no ref counting. if (!_storages.TryAdd(scopeId, storage)) { // this should make failure more explicit FailFast.OnFatalException(new Exception("who is adding same snapshot?")); } }
private PinnedRemotableDataScope( AssetStorages storages, AssetStorages.Storage storage, PinnedSolutionInfo solutionInfo) { _storages = storages; _storage = storage; SolutionInfo = solutionInfo; }
public static PinnedRemotableDataScope Create( AssetStorages storages, AssetStorages.Storage storage, Checksum solutionChecksum) { Contract.ThrowIfNull(solutionChecksum); var solutionInfo = new PinnedSolutionInfo( Interlocked.Increment(ref s_scopeId), storage.SolutionState.BranchId == storage.SolutionState.Workspace.PrimaryBranchId, storage.SolutionState.WorkspaceVersion, solutionChecksum); storages.RegisterSnapshot(solutionInfo.ScopeId, storage); return(new PinnedRemotableDataScope(storages, storage, solutionInfo)); }