-
Notifications
You must be signed in to change notification settings - Fork 39
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
Discussion about merging/porting Diplomat into this library #3
Comments
Hi @kiennt thank you for answering. I'm divided. In a way it would be great since it seems to be well implemented and would make it a lot easier to implement in GCloudex. On the other hand it would break the actual pattern used in this project and would create the need for more external dependencies. Do you have any experience using Diplomat? I'll have to give this some more thought in the coming weeks since I'll be very busy until the start of July but we'll keep talking. |
I am using diplomat in my project Here is some example of how to use diplomat # get objects from query
defmodule Tkn.AppSettingsController do
use Tkn.Web, :controller
def index(conn, _params) do
settings =
"SELECT * FROM AppSettings"
|> Query.new
|> Query.execute
|> List.first
|> Entity.properties
conn |> render(:index, settings: settings)
end
end
# complex example
def fetch_invitation(item, users) do
item
|> Map.put("user", users[item["user_key"]])
|> Map.put("inviter", users[item["inviter_key"]] |> Map.take(["id", "name", "image_url"]))
|> Map.take([
"id",
"user",
"inviter",
"status",
"shared_token_key",
"expire_date_time",
"circle_start_date_time",
"circle_end_date_time",
"circle_status",
"created_at",
"updated_at",
])
end
def show_invitations(conn, %{"circle_id" => circle_id}) do
{id, _} = Integer.parse(circle_id)
invitations =
"SELECT * FROM Invitation WHERE circle_key = @1"
|> Query.new([Key.new("Circle", id)])
|> Query.execute
|> Enum.map(&Entity.properties/1)
users =
invitations
|> Enum.reduce([], fn item, acc ->
acc ++ [item["user_key"], item["inviter_key"]]
end)
|> Key.get
|> Enum.map(fn item -> {item.key, Entity.properties(item)} end)
|> Enum.into(%{})
result =
invitations
|> Enum.map(&fetch_invitation(&1, users))
conn |> render(:show_invitations, invitations: result)
end I think if you want to implement API client for Datastore, the current pattern of this library is not suitable. Because API for datastore is RPC. It also supports REST API, but IMHO RPC is more efficient. |
But currently diplomat uses v2 API, which is around 2 times slower than v3. And as far as I read in diplomat repo, it's blocked because of lack of support of some protobuff features in their dependencies. So I think this is quite huge argument against diplomat in its' current version. |
@1337hax yes I prefer that the API is implemented natively in GCloudex. That way it's less one dependency and we get a tighter control on the implementation. |
Hi guys I think Diplomat 's implementation is good at this point. But after some time using GAE on my app, I think we should move to new What do you guys think? On Wed, Aug 10, 2016 at 6:37 AM, Phil Burrows [email protected]
Best regards |
Ecto support is actually the next big thing on the roadmap for Diplomat. There's a decent amount of work to do there, but I'm currently working on building an Ecto adapter within Diplomat. |
An Ecto adapter for Datastore and Bigtable is definitely interesting! @peburrows is this going to be done inside Diplomat or will it be an external project? |
My current plan is to implement it within Diplomat. Once I get into it a bit more, I might change my mind about that, but that's the direction I'm headed. |
@perburrows could you share with us more detail about your plan of support This is a really interesting. On Fri, Aug 12, 2016 at 2:34 AM, Phil Burrows [email protected]
Best regards |
@kiennt my ultimate goal is to provide full Ecto support for all features of Ecto that Datastore supports. I've only just begun the process, so there's plenty of work to do, but eventually, support should be thorough enough that you can use Diplomat like any other Ecto adapter. At a high level, this means a few things:
|
OK, now google data store has v1 stable REST api, i think supporting it would be very good. Any library has any plans for it ? |
@1337hax I agree, it should be supported. Diplomat will support it, I guess. I have GCloudex in the backburner right now, I can't really devote time to it this month. |
@1337hax, yeah, Diplomat will soon support the v1 API (it's currently on the most recent beta, v1beta3, so switching to the official v1 should be no problem). Somewhat related, I've also started work on an HTTP/2 client (it's called River) which is the first step toward the eventual goal of switching Diplomat (and my other GCP libraries) to use the gRPC APIs. |
@peburrows nice to know you are starting a project with HTTP/2 client. FYI, I also started a project related to HTTP/2 (but currently only HPACK part is imlemented). Looking forward to see news from River and Diplomat. |
Hi @sashaafm
As I told in email, currently I am forking Diplomat library at
https://github.com/kiennt/diplomat
This library is already support Google Datastore
Could you please check out this library and give me some comments/thoughts?
The text was updated successfully, but these errors were encountered: