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)
Attribute.GetCustomAttribute(Assembly, Type)
Attribute.GetCustomAttribute(Assembly, Type, Boolean)
Attribute.GetCustomAttribute(MemberInfo, Type)
Attribute.GetCustomAttribute(MemberInfo, Type, Boolean)
Attribute.GetCustomAttribute(Module, Type)
Attribute.GetCustomAttribute(Module, Type, Boolean)
Attribute.GetCustomAttribute(ParameterInfo, Type)
Attribute.GetCustomAttribute(ParameterInfo, Type, Boolean)
Attribute.GetCustomAttributes(Assembly)
Attribute.GetCustomAttributes(Assembly, Boolean)
Attribute.GetCustomAttributes(Assembly, Type)
Attribute.GetCustomAttributes(Assembly, Type, Boolean)
Attribute.GetCustomAttributes(MemberInfo)
Attribute.GetCustomAttributes(MemberInfo, Boolean)
Attribute.GetCustomAttributes(MemberInfo, 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)
Attribute.GetCustomAttributes(ParameterInfo, Boolean)
Attribute.GetCustomAttributes(ParameterInfo, Type)
Attribute.GetCustomAttributes(ParameterInfo, Type, Boolean)
Attribute.GetHashCode()
Attribute.IsDefaultAttribute()
Attribute.IsDefined(Assembly, Type)
Attribute.IsDefined(Assembly, Type, Boolean)
Attribute.IsDefined(MemberInfo, Type)
Attribute.IsDefined(MemberInfo, Type, Boolean)
Attribute.IsDefined(Module, Type)
Attribute.IsDefined(Module, Type, Boolean)
Attribute.IsDefined(ParameterInfo, Type)
Attribute.IsDefined(ParameterInfo, Type, Boolean)
Attribute.Match(Object)
Attribute.TypeId
Object.Equals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
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