Crate allfeat_midds

Crate allfeat_midds 

Source
Expand description

§Allfeat MIDDS - Music Industry Decentralized Data Structures

This crate provides Substrate-compatible implementations of MIDDS (Music Industry Decentralized Data Structures) for the Allfeat blockchain ecosystem.

§Overview

MIDDS defines standardized data structures for representing music industry entities:

  • Musical Works: Compositions and songs (identified by ISWC)
  • Party Identifiers: Artists, publishers, and other music industry parties (identified by IPI/ISNI)
  • Releases: Albums, EPs, and other music releases (identified by EAN/UPC)
  • Tracks: Individual recordings (identified by ISRC)

§Key Features

  • 🔗 Substrate Integration: Full compatibility with Substrate/Polkadot ecosystem
  • 🛡️ Type Safety: Strong typing with comprehensive validation
  • 🚀 Performance: Optimized for on-chain storage and operations
  • 🔄 Dual Types: Separate SDK and Runtime types for optimal UX and efficiency
  • 📊 Standards Compliant: Implements music industry standard identifiers

§Quick Start

use allfeat_midds::{
    party_identifier::Ipi,
    musical_work::Iswc,
    shared::conversion::Validatable,
};
use std::str::FromStr;

// Create music industry identifiers
let ipi: Ipi = 123456789;
let iswc = Iswc::from_str("T1234567890").unwrap();

// Validate identifiers (std feature required)
#[cfg(feature = "std")]
{
    assert!(iswc.validate().is_ok());
}

§Architecture

The crate is organized into several modules:

  • shared: Common types, identifiers, and utilities
  • musical_work: Musical work (composition) data structures
  • party_identifier: Party (artist/entity) identification
  • release: Music release data structures
  • track: Individual track/recording data structures

Each module provides both SDK types (for application development) and Runtime types (for blockchain storage), with automatic conversion between them.

§Feature Flags

  • std (default): Enables SDK types and validation features
  • try-runtime: Enables try-runtime features for Substrate integration
  • runtime-benchmarks: Enables benchmarking utilities for Substrate pallets

§Benchmarking Support

When the runtime-benchmarks feature is enabled, each MIDDS type provides benchmarking helpers to generate data of varying complexity for accurate weight calculation in Substrate pallets:

use allfeat_midds::{
    benchmarking::BenchmarkHelperT,
    track::Track,
    Midds,
};

// Generate MIDDS with specific complexity (0.0 = minimal, 1.0 = maximal)
let track = <Track as Midds>::BenchmarkHelper::variable_size(0.5);

// Or use predefined sizes
let min_track = <Track as Midds>::BenchmarkHelper::min_size();
let max_track = <Track as Midds>::BenchmarkHelper::max_size();

This enables precise weight calculation based on actual data size variations, following Substrate’s best practices for benchmarking.

Re-exports§

pub use shared::conversion;

Modules§

musical_work
Musical Work MIDDS
pallet_prelude
Prelude for pallet developers - contains all runtime types and commonly used imports
party_identifier
Party Identifier MIDDS
release
Release MIDDS
shared
Shared types and utilities used across all MIDDS
track
Track MIDDS

Traits§

Midds
Substrate-compatible MIDDS (Music Industry Decantralized Data Structure) interface definition.

Type Aliases§

MiddsId
Generic Midds Identifier expected to be used for storing in pallets.