Show / Hide Table of Contents

Class StoreLoaderAttribute

Registers a static method as a store loader. The method must comply with StoreLoader delegate.

Inheritance
Object
Attribute
StoreLoaderAttribute
Inherited Members
Attribute.Equals(Object)
System.Attribute.GetCustomAttribute(System.Reflection.Assembly, System.Type)
Attribute.GetCustomAttribute(Assembly, Type, Boolean)
System.Attribute.GetCustomAttribute(System.Reflection.MemberInfo, System.Type)
Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
Attribute.GetCustomAttribute(Module, Type)
System.Attribute.GetCustomAttribute(System.Reflection.Module, System.Type, System.Boolean)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly)
System.Attribute.GetCustomAttributes(System.Reflection.Assembly, System.Boolean)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Boolean)
System.Attribute.GetCustomAttributes(System.Reflection.MemberInfo, System.Type)
Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
Attribute.GetCustomAttributes(Module)
Attribute.GetCustomAttributes(Module, Boolean)
Attribute.GetCustomAttributes(Module, Type)
Attribute.GetCustomAttributes(Module, Type, Boolean)
Attribute.GetCustomAttributes(ParameterInfo)
System.Attribute.GetCustomAttributes(System.Reflection.ParameterInfo, System.Boolean)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
System.Attribute.GetHashCode()
Attribute.IsDefaultAttribute()
System.Attribute.IsDefined(System.Reflection.Assembly, System.Type)
Attribute.IsDefined(Assembly, Type, Boolean)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, Boolean)
System.Attribute.IsDefined(System.Reflection.Module, System.Type)
System.Attribute.IsDefined(System.Reflection.Module, System.Type, System.Boolean)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, Boolean)
Attribute.Match(Object)
Attribute.TypeId
Object.Equals(Object, Object)
System.Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
System.Object.ToString()
Namespace: Libplanet.Store
Assembly: Libplanet.Store.dll
Syntax
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public class StoreLoaderAttribute : Attribute
Examples

With the below code, SampleStore and SampleStateStore-backed TrieStateStore can be instantiated from a URI like sample:///home/foo/bar?cache=512:

[StoreLoader("sample")]
private static (IStore Store, IStateStore StateStore) Loader(Uri storeUri)
{
    NameValueCollection query = HttpUtility.ParseQueryString(storeUri.Query);
    int cache = query.GetInt32("cache", 128);
    var store = new SampleStore(storeUri.LocalPath, cache);
    var stateStore = new SampleStateStore(storeUri.LocalPath, cache);
    return (store, stateStore);
}

Constructors

| Improve this Doc View Source

StoreLoaderAttribute(String)

Instniates a new StoreLoaderAttribute with the specified uriScheme.

Declaration
public StoreLoaderAttribute(string uriScheme)
Parameters
Type Name Description
String uriScheme

The URI scheme to associate with the attributed store loader method.

Properties

| Improve this Doc View Source

UriScheme

The URI scheme to associate with the attributed store loader method.

Declaration
public string UriScheme { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

ListStoreLoaders()

Lists all registered store loaders.

Declaration
public static IEnumerable<(string UriScheme, Type DeclaringType)> ListStoreLoaders()
Returns
Type Description
IEnumerable<(T1 Item1, T2 Item2)<String, Type>>

Pairs of registered URI scheme and declaring type.

| Improve this Doc View Source

LoadStore(Uri)

Loads a pair of IStore and IStateStore from the specified storeUri.

Declaration
public static (IStore Store, IStateStore StateStore)? LoadStore(Uri storeUri)
Parameters
Type Name Description
Uri storeUri

A URI referring to a store.

Returns
Type Description
Nullable<(T1 Item1, T2 Item2)<IStore, IStateStore>>

A pair of loaded IStore and IStateStore.

  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium