private IMemoryStorageGrain GetStorageGrain(string id) { int idx = StorageProviderUtils.PositiveHash(id.GetHashCode(), this.storageGrains.Length); IMemoryStorageGrain storageGrain = storageGrains[idx].Value; return(storageGrain); }
/// <summary> /// Return a hash value derived from the input grain type and id values. /// </summary> /// <param name="grainType">Fully qualified class type name for this grain</param> /// <param name="grainReference">GrainI reference for this grain</param> /// <returns>Stable hash value for this grain</returns> protected virtual int HashFunction(string grainType, GrainReference grainReference) { return(StorageProviderUtils.PositiveHash(grainReference, storageProviders.Length)); }