-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#989 Added first working in simul main of Virtualized table.
- Loading branch information
1 parent
18bf20f
commit 857a681
Showing
52 changed files
with
619 additions
and
152 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
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
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
86 changes: 86 additions & 0 deletions
86
...able/src/test/scala/org/finos/vuu/example/virtualized/table/VirtualizedViewPortTest.scala
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,86 @@ | ||
package org.finos.vuu.example.virtualized.table | ||
|
||
import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} | ||
import org.finos.toolbox.lifecycle.LifecycleContainer | ||
import org.finos.toolbox.time.{Clock, TestFriendlyClock} | ||
import org.finos.vuu.core.module.TableDefContainer | ||
import org.finos.vuu.example.virtualtable.module.VirtualTableModule | ||
import org.finos.vuu.plugin.virtualized.VirtualizedTablePlugin | ||
import org.finos.vuu.provider.VirtualizedProvider | ||
import org.finos.vuu.test.VuuServerTestCase | ||
import org.finos.vuu.util.table.TableAsserts.assertVpEq | ||
import org.finos.vuu.viewport.ViewPortRange | ||
import org.scalatest.prop.Tables.Table | ||
|
||
class VirtualizedViewPortTest extends VuuServerTestCase { | ||
|
||
Feature("Virtualized Table Viewport") { | ||
|
||
Scenario("Check creation of a virtualized viewport") { | ||
|
||
implicit val clock: Clock = new TestFriendlyClock(10001L) | ||
implicit val lifecycle: LifecycleContainer = new LifecycleContainer() | ||
implicit val tableDefContainer: TableDefContainer = new TableDefContainer(Map()) | ||
implicit val metricsProvider: MetricsProvider = new MetricsProviderImpl | ||
|
||
withVuuServer(VirtualTableModule()) { | ||
vuuServer => | ||
|
||
vuuServer.registerPlugin(new VirtualizedTablePlugin()) | ||
|
||
vuuServer.login("testUser", "testToken") | ||
|
||
val viewport = vuuServer.createViewPort(VirtualTableModule.NAME, "bigOrders", ViewPortRange(0, 10)) | ||
|
||
val virtualizedProvider = viewport.table.asTable.getProvider.asInstanceOf[VirtualizedProvider] | ||
|
||
virtualizedProvider.runOnce(viewport) | ||
|
||
assertVpEq(combineQsForVp(viewport)) { | ||
Table( | ||
("orderId" ,"quantity","price" ,"side" ,"trader" ), | ||
("0" ,-1155484576,-3109364765729502342L,"Buy" ,"trader1" ), | ||
("1" ,-1155869325,1853403699951111791L,"Sell" ,"trader1" ), | ||
("2" ,-1154715079,5411842376618821008L,"Sell" ,"trader1" ), | ||
("3" ,-1155099828,-8072133231410116475L,"Buy" ,"trader1" ), | ||
("4" ,-1157023572,-1705034981011564721L,"Buy" ,"trader1" ), | ||
("5" ,-1157408321,3257733484669049412L,"Buy" ,"trader1" ), | ||
("6" ,-1156254074,6816172161336758629L,"Sell" ,"trader1" ), | ||
("7" ,-1156638823,-6667803446692178854L,"Sell" ,"trader1" ), | ||
("8" ,-1158562568,-300705196293627100L,"Sell" ,"trader1" ), | ||
("9" ,-1158947317,4662063269386987033L,"Buy" ,"trader1" ) | ||
) | ||
} | ||
|
||
viewport.setRange(ViewPortRange(5, 15)) | ||
|
||
assertVpEq(combineQsForVp(viewport)) { | ||
Table( | ||
("orderId" ,"quantity","price" ,"side" ,"trader" ), | ||
(null ,null ,null ,null ,null ) | ||
) | ||
} | ||
|
||
virtualizedProvider.runOnce(viewport) | ||
|
||
assertVpEq(combineQsForVp(viewport)) { | ||
Table( | ||
("orderId" ,"quantity","price" ,"side" ,"trader" ), | ||
("10" ,-1157793070,8220501950349663546L,"Sell" ,"trader1" ), | ||
("11" ,-1158177819,-5263473657679273937L,"Sell" ,"trader1" ), | ||
("12" ,-1160101563,1103624592719277817L,"Sell" ,"trader1" ), | ||
("13" ,-1160486312,6066393058399891950L,"Sell" ,"trader1" ), | ||
("14" ,-1159332065,-8821912338641950449L,"Buy" ,"trader1" ), | ||
("5" ,-1157408321,3257733484669049412L,"Buy" ,"trader1" ), | ||
("6" ,-1156254074,6816172161336758629L,"Sell" ,"trader1" ), | ||
("7" ,-1156638823,-6667803446692178854L,"Sell" ,"trader1" ), | ||
("8" ,-1158562568,-300705196293627100L,"Sell" ,"trader1" ), | ||
("9" ,-1158947317,4662063269386987033L,"Buy" ,"trader1" ) | ||
) | ||
} | ||
} | ||
|
||
} | ||
|
||
} | ||
} |
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
40 changes: 40 additions & 0 deletions
40
...table-plugin/src/main/scala/org/finos/vuu/plugin/virtualized/VirtualizedTablePlugin.scala
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,40 @@ | ||
package org.finos.vuu.plugin.virtualized | ||
|
||
import org.finos.toolbox.jmx.MetricsProvider | ||
import org.finos.vuu.api.TableDef | ||
import org.finos.vuu.core.table.InMemDataTable | ||
import org.finos.vuu.feature.{FilterFactory, JoinTableFactory, SessionTableFactory, SortFactory, TableFactory, ViewPortCallableFactory, ViewPortFactory, ViewPortKeysCreator, ViewPortTableCreator, ViewPortTreeCallableFactory} | ||
import org.finos.vuu.plugin.virtualized.plugin.ViewPortVirtualizedTableCreator | ||
import org.finos.vuu.plugin.virtualized.viewport.VirtualizedViewPortCallableFactory | ||
import org.finos.vuu.plugin.{DefaultPlugin, PluginType} | ||
import org.finos.vuu.provider.JoinTableProvider | ||
|
||
|
||
object VirtualizedTablePlugin extends DefaultPlugin { | ||
|
||
final val callableFactory = new VirtualizedViewPortCallableFactory | ||
|
||
override def tableFactory(implicit metrics: MetricsProvider): TableFactory = (tableDef: TableDef, joinTableProvider: JoinTableProvider) => { | ||
new InMemDataTable(tableDef, joinTableProvider) | ||
} | ||
|
||
override def pluginType: PluginType = VirtualizedTablePluginType | ||
|
||
override def joinTableFactory(implicit metrics: MetricsProvider): JoinTableFactory = ??? | ||
|
||
override def sessionTableFactory: SessionTableFactory = ??? | ||
|
||
override def viewPortKeysCreator: ViewPortKeysCreator = ??? | ||
|
||
override def viewPortFactory: ViewPortFactory = ??? | ||
|
||
override def filterFactory: FilterFactory = ??? | ||
|
||
override def sortFactory: SortFactory = ??? | ||
|
||
override def viewPortCallableFactory: ViewPortCallableFactory = callableFactory | ||
|
||
override def viewPortTreeCallableFactory: ViewPortTreeCallableFactory = ??? | ||
|
||
override def viewPortTableCreator: ViewPortTableCreator = ViewPortVirtualizedTableCreator | ||
} |
5 changes: 5 additions & 0 deletions
5
...lugin/src/main/scala/org/finos/vuu/plugin/virtualized/VirtualizedTablePluginLocator.scala
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,5 @@ | ||
package org.finos.vuu.plugin.virtualized | ||
|
||
import org.finos.vuu.plugin.PluginType | ||
|
||
object VirtualizedTablePluginType extends PluginType |
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
30 changes: 30 additions & 0 deletions
30
.../main/scala/org/finos/vuu/plugin/virtualized/plugin/ViewPortVirtualizedTableCreator.scala
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,30 @@ | ||
package org.finos.vuu.plugin.virtualized.plugin | ||
|
||
import org.finos.toolbox.jmx.MetricsProvider | ||
import org.finos.toolbox.time.Clock | ||
import org.finos.vuu.core.table.TableContainer | ||
import org.finos.vuu.feature.ViewPortTableCreator | ||
import org.finos.vuu.net.ClientSessionId | ||
import org.finos.vuu.plugin.virtualized.api.VirtualizedSessionTableDef | ||
import org.finos.vuu.plugin.virtualized.table.VirtualizedSessionTable | ||
import org.finos.vuu.viewport.{GroupBy, RowSource} | ||
|
||
object ViewPortVirtualizedTableCreator extends ViewPortTableCreator{ | ||
|
||
override def create(table: RowSource, clientSession: ClientSessionId, groupBy: GroupBy, tableContainer: TableContainer)(implicit metrics: MetricsProvider, clock: Clock): RowSource = { | ||
|
||
assert(table.asTable.getTableDef.isInstanceOf[VirtualizedSessionTableDef]) | ||
|
||
val sessionTableDef = table.asTable.getTableDef.asInstanceOf[VirtualizedSessionTableDef] | ||
|
||
val sessionTable = new VirtualizedSessionTable(clientSession, sessionTableDef, tableContainer.joinTableProvider, cacheSize = 20_000) | ||
|
||
val archetypeTable = tableContainer.getTable(sessionTableDef.name) | ||
|
||
val provider = archetypeTable.getProvider | ||
|
||
sessionTable.setProvider(provider) | ||
|
||
sessionTable | ||
} | ||
} |
18 changes: 0 additions & 18 deletions
18
...zed-table-plugin/src/main/scala/org/finos/vuu/plugin/virtualized/table/RollingCache.scala
This file was deleted.
Oops, something went wrong.
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
7 changes: 4 additions & 3 deletions
7
...n/src/main/scala/org/finos/vuu/plugin/virtualized/table/VirtualizedSessionTableData.scala
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.