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

bs-lang hack has stopped working, so lets use the official API ( Ready for review ) #119

Open
joe-getcouragenow opened this issue Jan 27, 2021 · 0 comments

Comments

@joe-getcouragenow
Copy link
Contributor

joe-getcouragenow commented Jan 27, 2021

Use GCS for cache, make it public.
Use official Google Translate API

Design

Ops

  • We will operate this under the ops@getcourgaenow account. We use it for other things like this.

Sec

  • Because we are going to use this for the CLI and Server, the caller needs to handle collecting credentials and passing it down.
  • At runtime, the CLi should ask for auth credentials, and then cache and proceed.
  • At runtime, the Server ( for product example below ) needs to pull credentials from config.

Logic flow

  • Check cache for miss, etc
  • check google trans, and update cache and return data.

HIL ( human in loops )

  • Cli can edit the cache on Google.
  • Ops needed are search, listall, replace, delete, deleteall ( requires special "-f" flag for force ).

HA

  • google gives it for free.
  • But we might need to copy all of a cache and then move all the data to another account..
  • So maybe we need a backup and restore. THis is really like what our real Operations needs to backup data to google and then restore from it. So if we make this work for this Issue we can reuse it for that too.

Suggested code approach:

shared/servers/google

  • shared code for accessing google storage that can be used by bs-lang but also other things we will need for various functionality we need now and going forward.
  • https://github.com/creachadair/gcsstore and https://github.com/creachadair/badgerstore both implement the same interface of https://github.com/creachadair/ffs
    • Seems like a good fit because its a KV the Ops and Auth aspects we need.
    • We will need to also do the same with badger acting as a Lang Service cache for the Product. By Product i mean that the system will need to provide at runtime a translation service ( for example real time translated chat), and we will want to cache it in our google storage cache and in their server ( which uses badger ).
  • creachadair wraps the https://github.com/google/go-cloud which is also agnostic, so we have options going forward

shared/tool/bs-lang/services/translation.go

  • rename it hackgoogletranslation.go, in case the hack gets fixed, but dont call it from anywhere.

shared/tool/bs-lang/services/googletranslation.go

  • new file.
  • match the funcs from translation.go
  • imports shared/servers/google
  • does the logic

shared/tool/bs-lang/services/write.go

  • func GenerateMultiLanguageFilesFromTemplate is the entry point from the looks of it.
  • calls translation.go, so change to call same method signature in googtranslation.go

auth approach:

  • Make it work with and without auth. We will need both.
  • For auth, use a Google Service Token. The caller ( CLi and later other things ) needs to have that in their config.
    • Its a pain that bs-lang for a developer will need a config. But looks like we have no choice.
@joe-getcouragenow joe-getcouragenow changed the title bs-lang needs to use official API. bs-lang hack has stopped working, so lets use the official API. Jan 27, 2021
@joe-getcouragenow joe-getcouragenow changed the title bs-lang hack has stopped working, so lets use the official API. bs-lang hack has stopped working, so lets use the official API ( Ready for review ) Jan 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant