Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use separate mpl_core table #180

Closed
wants to merge 12 commits into from
2 changes: 2 additions & 0 deletions Api.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/das_api
Expand All @@ -31,6 +32,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/das_api
Expand Down
33 changes: 31 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ anyhow = "1.0.75"
async-std = "1.0.0"
async-trait = "0.1.60"
backon = "0.4.1"
blockbuster = "2.0.0"
blockbuster = { version = "2.0.0", git = "https://github.com/metaplex-foundation/blockbuster.git", rev = "66ca5f54106bbd3cb82aaf18cf8089b5ef7f78fc" }
borsh = "~0.10.3"
borsh-derive = "~0.10.3"
bs58 = "0.4.0"
Expand All @@ -50,6 +50,7 @@ figment = "0.10.8"
flatbuffers = "23.1.21"
function_name = "0.3.0"
futures = "0.3.28"
heck = "0.5.0"
hex = "0.4.3"
hyper = "0.14.23"
indexmap = "1.9.3"
Expand Down
2 changes: 2 additions & 0 deletions Ingest.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/nft_ingester
Expand All @@ -31,6 +32,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/nft_ingester
Expand Down
2 changes: 2 additions & 0 deletions Load.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/tools/load_generation
Expand All @@ -31,6 +32,7 @@ COPY metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY migration /rust/migration
COPY nft_ingester /rust/nft_ingester
COPY ops /rust/ops
COPY program_transformers /rust/program_transformers
COPY tools /rust/tools

WORKDIR /rust/tools/load_generation
Expand Down
1 change: 1 addition & 0 deletions Migrator.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ COPY ./metaplex-rpc-proxy /metaplex-rpc-proxy
COPY ./migration /migration
COPY ./nft_ingester /nft_ingester
COPY ./ops /ops
COPY ./program_transformers /program_transformers
COPY ./tools /tools

WORKDIR /migration
Expand Down
1 change: 1 addition & 0 deletions Proxy.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ COPY ./metaplex-rpc-proxy /rust/metaplex-rpc-proxy
COPY ./migration /rust/migration
COPY ./nft_ingester /rust/nft_ingester
COPY ./ops /rust/ops
COPY ./program_transformers /rust/program_transformers
COPY ./tools /rust/tools

WORKDIR /rust/metaplex-rpc-proxy
Expand Down
10 changes: 9 additions & 1 deletion digital_asset_types/src/dao/extensions/asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use sea_orm::{EntityTrait, EnumIter, Related, RelationDef, RelationTrait};

use crate::dao::{
asset, asset_authority, asset_creators, asset_data, asset_grouping,
asset_v1_account_attachments,
asset_v1_account_attachments, mpl_core,
sea_orm_active_enums::{OwnerType, RoyaltyTargetType},
};

Expand All @@ -13,6 +13,7 @@ pub enum Relation {
AssetAuthority,
AssetCreators,
AssetGrouping,
MplCore,
}

impl RelationTrait for Relation {
Expand All @@ -28,6 +29,7 @@ impl RelationTrait for Relation {
Self::AssetAuthority => asset::Entity::has_many(asset_authority::Entity).into(),
Self::AssetCreators => asset::Entity::has_many(asset_creators::Entity).into(),
Self::AssetGrouping => asset::Entity::has_many(asset_grouping::Entity).into(),
Self::MplCore => asset::Entity::has_one(mpl_core::Entity).into(),
}
}
}
Expand Down Expand Up @@ -62,6 +64,12 @@ impl Related<asset_grouping::Entity> for asset::Entity {
}
}

impl Related<mpl_core::Entity> for asset::Entity {
fn to() -> RelationDef {
Relation::MplCore.def()
}
}

impl Default for RoyaltyTargetType {
fn default() -> Self {
Self::Creators
Expand Down
1 change: 1 addition & 0 deletions digital_asset_types/src/dao/extensions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pub mod asset_data;
pub mod asset_grouping;
pub mod asset_v1_account_attachment;
pub mod instruction;
pub mod mpl_core;
25 changes: 25 additions & 0 deletions digital_asset_types/src/dao/extensions/mpl_core.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use sea_orm::{EntityTrait, EnumIter, Related, RelationDef, RelationTrait};

use crate::dao::{asset, mpl_core};

#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {
Asset,
}

impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
match self {
Self::Asset => mpl_core::Entity::belongs_to(asset::Entity)
.from(mpl_core::Column::AssetId)
.to(asset::Column::Id)
.into(),
}
}
}

impl Related<asset::Entity> for mpl_core::Entity {
fn to() -> RelationDef {
Relation::Asset.def()
}
}
4 changes: 3 additions & 1 deletion digital_asset_types/src/dao/full_asset.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::dao::{asset, asset_authority, asset_creators, asset_data, asset_grouping};
use crate::dao::{asset, asset_authority, asset_creators, asset_data, asset_grouping, mpl_core};

#[derive(Clone, Debug, PartialEq)]
pub struct FullAsset {
Expand All @@ -7,7 +7,9 @@ pub struct FullAsset {
pub authorities: Vec<asset_authority::Model>,
pub creators: Vec<asset_creators::Model>,
pub groups: Vec<asset_grouping::Model>,
pub mpl_core: Option<mpl_core::Model>,
}

#[derive(Clone, Debug, PartialEq)]
pub struct AssetRelated {
pub authorities: Vec<asset_authority::Model>,
Expand Down
1 change: 1 addition & 0 deletions digital_asset_types/src/dao/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub mod asset_v1_account_attachments;
pub mod backfill_items;
pub mod cl_audits_v2;
pub mod cl_items;
pub mod mpl_core;
pub mod raw_txn;
pub mod sea_orm_active_enums;
pub mod tasks;
Expand Down
79 changes: 79 additions & 0 deletions digital_asset_types/src/dao/generated/mpl_core.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
//! SeaORM Entity. Generated by sea-orm-codegen 0.9.3

use sea_orm::entity::prelude::*;
use serde::{Deserialize, Serialize};

#[derive(Copy, Clone, Default, Debug, DeriveEntity)]
pub struct Entity;

impl EntityName for Entity {
fn table_name(&self) -> &str {
"mpl_core"
}
}

#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Serialize, Deserialize)]
pub struct Model {
pub id: i64,
pub asset_id: Vec<u8>,
pub seq: Option<i64>,
pub slot_updated: Option<i64>,
pub plugins: Option<Json>,
pub unknown_plugins: Option<Json>,
pub plugins_json_version: Option<i32>,
pub collection_num_minted: Option<i32>,
pub collection_current_size: Option<i32>,
}

#[derive(Copy, Clone, Debug, EnumIter, DeriveColumn)]
pub enum Column {
Id,
AssetId,
Seq,
SlotUpdated,
Plugins,
UnknownPlugins,
PluginsJsonVersion,
CollectionNumMinted,
CollectionCurrentSize,
}

#[derive(Copy, Clone, Debug, EnumIter, DerivePrimaryKey)]
pub enum PrimaryKey {
Id,
}

impl PrimaryKeyTrait for PrimaryKey {
type ValueType = i64;
fn auto_increment() -> bool {
true
}
}

#[derive(Copy, Clone, Debug, EnumIter)]
pub enum Relation {}

impl ColumnTrait for Column {
type EntityName = Entity;
fn def(&self) -> ColumnDef {
match self {
Self::Id => ColumnType::BigInteger.def(),
Self::AssetId => ColumnType::Binary.def(),
Self::Seq => ColumnType::BigInteger.def().null(),
Self::SlotUpdated => ColumnType::BigInteger.def().null(),
Self::Plugins => ColumnType::JsonBinary.def().null(),
Self::UnknownPlugins => ColumnType::JsonBinary.def().null(),
Self::PluginsJsonVersion => ColumnType::Integer.def().null(),
Self::CollectionNumMinted => ColumnType::Integer.def().null(),
Self::CollectionCurrentSize => ColumnType::Integer.def().null(),
}
}
}

impl RelationTrait for Relation {
fn def(&self) -> RelationDef {
panic!("No RelationDef")
}
}

impl ActiveModelBehavior for ActiveModel {}
1 change: 1 addition & 0 deletions digital_asset_types/src/dao/generated/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pub use super::asset_v1_account_attachments::Entity as AssetV1AccountAttachments
pub use super::backfill_items::Entity as BackfillItems;
pub use super::cl_audits_v2::Entity as ClAuditsV2;
pub use super::cl_items::Entity as ClItems;
pub use super::mpl_core::Entity as MplCore;
pub use super::raw_txn::Entity as RawTxn;
pub use super::tasks::Entity as Tasks;
pub use super::token_accounts::Entity as TokenAccounts;
Expand Down
Loading
Loading