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