Skip to content

Latest commit

 

History

History
104 lines (84 loc) · 4.12 KB

TODO.md

File metadata and controls

104 lines (84 loc) · 4.12 KB

TODO

  • Move data array into model properties.

    • This require getData() method to collect all property value.

    • Getter should inflate the value from property

    • The find method should simply return the record instead of the result. Reason: we don't wrap the query logic with try&catch block now. errors will throw if something happens.

    • The create method should simply return the result (we can load the result later) $ret = $book->create(); $newBook = $book->createAndLoad();

      Fix all test cases according to the new return type

      • BaseModel::create now returns Result object directly and don't reload created data to the object itself.

      • BaseModel::find now returns the found record instead of load the data to the object itself.

    • Result->getKey() to make the API consistent.

    • BaseModel::find is now static method.

    • BaseModel::createAndLoad is now static method.

    • Inflate by the isa in the automatic generated accessor.

    • Cache query driver

    • BaseModel::getReadConnection removed.

    • ::load method refactor.

    • ::create method refactor.

  • Generate BaseRepo Class

    • Add ::repo($ds) helper to create repo with specific connection.
    • Add ::repo($write, $read) helper to create repo with specific connection.
    • Add ::repo($write) ($read = $write)
    • Add ::repo() (using default connections)
    • Add ::masterRepo() (using default connections)
    • Move find* method to Repo class.
    • Move create method to Repo class.
    • Move delete method to Repo class.
  • Add facelet static methods on BaseModel to connect BaseRepo methods.

  • Generate setter methods on BaseModel.

  • Setter should deflate the value from the value.

  • Refactor Connection create functions to different Connector.

  • Sharding Support

    • Support node config definition

    • Support shard mapping config definition

    • Add basic shard dispatcher base on Flexihash

    • Add "prepare" method generator for Repo classes.

    • Use repo class in BaseCollection

    • Rename "getDefaultConnection" to "getMasterConnection".

    • Shard method

    • Shard by Hash

    • Shard::createRepo() return a repo object with read/write connection.

    • Rename "default" config to "master".

    • Global Table behaviour

      • Spread Create method
        • Create records across different shards.
      • Spread Update method
        • Update records across different shards.
      • Spread Delete method
        • Delete records across different shards.
    • Extract SQL building method for create (insertion)

    • Extract SQL building method for update

    • Extract SQL building method for delete

    • Map SQL and arguments to QueryWorker and then reduce the result...

    • ShardDispatcher

      • Select shard for write
      • Select shard for read.
    • QueryDispatcher

      • Given a query, return Repo objects with different connections and run queries on these nodes.
    • QueryMapper

    • Shard by Range

    • Virtual Shards (by using larger key space)

    $shards = Book::shards(); // returns Shards of the model.

    // Dispatch to one repository by $key and create the record in the repository. Order::shards()->dispatch($key)->create($args);

    // Automatically dispatch the repository by the "key" defined in $args. Order::shards()->create($args);

    $order = Order::shards()->find(77890);

    $order = Order::shards()->find('569f21d7-fcad-49bf-99dd-795be631f984');

  • Move CRUD operation from modal class to ModelActions class.

  • Add connection parameter to all the CRUD methods

  • Add setter type signature support to the class method generator.

  • Validate isa type when setting value via setter method.

  • ??? Remove typeConstraint checking from modal method code.