forked from Joystream/hydra
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hydra-processor): use mappings contexts and support specVersion …
…filters (Joystream#375) * refactor(hydra-common): remove util functions from hydra-common and update references affects: @dzlzv/hydra-common, @dzlzv/hydra-indexer, @dzlzv/hydra-processor * feat(hydra-processor): wIP: use refactored hydra-common interfaces affects: @dzlzv/hydra-common, @dzlzv/hydra-processor * feat(hydra-common): move BlockPayload interfaces to hydra-common affects: @dzlzv/hydra-common, @dzlzv/hydra-indexer * feat(hydra-processor): wip 2 * refactor(hydra-indexer): move FIFOCache to hydra-common affects: @dzlzv/hydra-common, @dzlzv/hydra-indexer * chore(sample): add docker-compose-dev for starting a local indexer affects: sample * feat(hydra-processor): wip2: block queries + handler filters affects: @dzlzv/hydra-processor, sample, sample-mappings * feat(hydra-common): add context interfaces and move database-manager to hydra-common affects: @dzlzv/hydra-common * fix(hydra-indexer): use BigInt and update DatabaseManager imports affects: @dzlzv/hydra-indexer * feat(hydra-processor): add specVersion filtering and cleanup affects: @dzlzv/hydra-processor * feat(hydra-db-utils): move DatabaseManager to hydra-common affects: @dzlzv/hydra-db-utils * feat(sample): use Context interfaces in the mappings affects: sample, sample-mappings * fix(hydra-processor): add filtering for hooks affects: @dzlzv/hydra-processor * fix(hydra-processor): add reviver for BigInt/Number fields that are not properly deserialized from t affects: @dzlzv/hydra-processor * fix(hydra-indexer): initialized from BLOCK_HEIGHT if not previous head was saved (fixes undefined he affects: @dzlzv/hydra-indexer * test(sample): add DateTime field to sample affects: sample, sample-mappings * test(hydra-e2e-tests): fix manifest and mappings in e2e-tests affects: hydra-e2e-tests * fix(hydra-processor): fix tests affects: @dzlzv/hydra-processor
- Loading branch information
Showing
68 changed files
with
1,588 additions
and
983 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SubstrateBlock, SubstrateEvent, SubstrateExtrinsic } from '.' | ||
import { DatabaseManager } from './store' | ||
|
||
export interface StoreContext { | ||
store: DatabaseManager | ||
} | ||
|
||
export interface BlockContext { | ||
block: SubstrateBlock | ||
} | ||
|
||
export interface EventContext extends BlockContext { | ||
event: SubstrateEvent | ||
extrinsic?: SubstrateExtrinsic | ||
} | ||
|
||
export interface ExtrinsicContext extends BlockContext { | ||
event: SubstrateEvent | ||
extrinsic: SubstrateExtrinsic | ||
} | ||
|
||
export type MappingContext = BlockContext | EventContext | ExtrinsicContext | ||
|
||
export type ExecContext = StoreContext & MappingContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
export * from './json-types' | ||
export * from './payloads' | ||
export * from './contexts' | ||
export * from './store' | ||
export * from './typeorm' | ||
export * from './substrate-interfaces' |
22 changes: 6 additions & 16 deletions
22
...s/hydra-indexer/src/model/BlockPayload.ts → ...s/hydra-common/src/interfaces/payloads.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { DeepPartial, FindOneOptions } from './typeorm' | ||
|
||
export interface DatabaseManager { | ||
/** | ||
* Save given entity instance, if entity is exists then just update | ||
* @param entity | ||
*/ | ||
save<T>(entity: DeepPartial<T>): Promise<void> | ||
|
||
/** | ||
* Removes a given entity from the database. | ||
* @param entity: DeepPartial<T> | ||
*/ | ||
remove<T>(entity: DeepPartial<T>): Promise<void> | ||
|
||
/** | ||
* Finds first entity that matches given options. | ||
* @param entity: T | ||
* @param options: FindOneOptions<T> | ||
*/ | ||
get<T>( | ||
entity: { new (...args: any[]): T }, | ||
options: FindOneOptions<T> | ||
): Promise<T | undefined> | ||
|
||
/** | ||
* Finds entities that match given options. | ||
* @param entity: T | ||
* @param options: FindOneOptions<T> | ||
*/ | ||
getMany<T>( | ||
entity: { new (...args: any[]): T }, | ||
options: FindOneOptions<T> | ||
): Promise<T[]> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.