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

0.2.0 is developed!! #12

Merged
merged 170 commits into from
Feb 21, 2024
Merged

0.2.0 is developed!! #12

merged 170 commits into from
Feb 21, 2024

Conversation

pojiro
Copy link
Contributor

@pojiro pojiro commented Feb 12, 2024

実装について

Connpass の ZettaScale CEO/CTO直伝!Zenoh完全理解セミナー! に添付の 2023.12.19-Understanding-Zenoh-V1.1.pdf の p34 記載の以下を実装可能な API 及びそのテストを実装しました。

  • Publisher
  • Subscriber
  • PullSubscriber
  • Session
  • Queryable
  • Storage

ドキュメントについて

本ブランチを clone し、 mix docs を実行することでお手元でご確認いただけます。
実装した API は zenoh の薄いラッパーであるため、それらを使って Elixir で機能を構成するには、ユーザは自身で実装する必要が有ります。これについては、 Example 実装を付与することで解消を狙っています。 Examples の実装は以下に有ります。

また、これら Examples もテスト及びドキュメントも作成しています。それぞれ以下を参照ください。

Raspberry Pi 4 上での動作について

実装したすべてのテストが aarch64 のラズパイ4 Ubuntu で Pass することを確認済みです。

image

Nerves での, v0.2.0-rc.2 の動作確認

以下のリポジトリを使い、作ったファームウェアで実行した RPI4 で Zenohex の Examples が動作することを確認しました。

以下はその時の iex シェルです。ストレージ/セッションを起動し、セッションからデータの put/delete/get を行った結果です。

iex(2)> Zenohex.Examples.Storage.start_link() # start storage
{:ok, #PID<0.1332.0>}
iex(3)> Zenohex.Examples.Session.start_link() # start session
{:ok, #PID<0.1336.0>}
iex(4)> Zenohex.Examples.Session.put("zenohex/examples/piyo", "put") # put data
:ok
iex(5)> Zenohex.Examples.Session.put("zenohex/examples/hoge", "put") # put data
:ok
iex(6)> Zenohex.Examples.Session.put("zenohex/examples/fuga", "put") # put data
:ok
iex(7)> Zenohex.Examples.Session.get("zenohex/examples/**", &IO.inspect/1) # get data
:ok
%Zenohex.Sample{
  key_expr: "zenohex/examples/piyo",
  value: "put",
  kind: :put,
  reference: #Reference<0.1954083461.2485256205.108764>
}
%Zenohex.Sample{
  key_expr: "zenohex/examples/hoge",
  value: "put",
  kind: :put,
  reference: #Reference<0.1954083461.2485256208.108812>
}
%Zenohex.Sample{
  key_expr: "zenohex/examples/fuga",
  value: "put",
  kind: :put,
  reference: #Reference<0.1954083461.2485256205.108765>
}
iex(8)> Zenohex.Examples.Session.delete("zenohex/examples/**") # delete data
:ok
iex(9)> Zenohex.Examples.Session.get("zenohex/examples/**", &IO.inspect/1) # get data again
:ok

pojiro added 30 commits January 19, 2024 10:17
rustler が panic をハンドリングしてくれることがわかったのでエラーハンドリングを簡素化
Elixir では String.t() は binary() でまかなえるため
"""
====================================================================
HEY, ZENOHEX DEVELOPER. IF YOU WANNA REDUCE TEST TIME, DO FOLLOWINGS
export API_OPEN_SESSION_DELAY=0 && mix compile --force
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API_OPEN_SESSION_DELAY=0 mix test

かなと思ったんですが,意図が違うでしょうか?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

事実

API_OPEN_SESSION_DELAY は動的に変えられるものではなく、NIFの Rust コードのコンパイル時に効く環境変数です。
なので、 export API_OPEN_SESSION_DELAY=0 && mix compile --force で NIF so の再ビルドをさせたいのがココでの意図です。実行後の mix test が早くなります。

相談

高瀬さんが疑問に思ったことは、誰でも疑問に思う可能性があるので、その旨を伝えられるようなコメントにしたいのですが、良さそうなアイデアはありますでしょうか?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なるほど理解しました.
README には For Developers のセクションで mix test のあれこれを書こうと思っています.その文面はのちほど review してください 🙏
assertとしてはこれで十分かと!

Add trigger condtion on push to main

Co-authored-by: takasehideki <[email protected]>
@pojiro pojiro requested a review from takasehideki February 19, 2024 04:06
@pojiro
Copy link
Contributor Author

pojiro commented Feb 19, 2024

@takasehideki @s-hosoai

All your reviews have been reflected. Thank you!!! Feel free to merge when you would like to do.

@pojiro pojiro mentioned this pull request Feb 20, 2024
2 tasks
Copy link
Contributor

@takasehideki takasehideki left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

go! merging into the world!!

@takasehideki takasehideki merged commit a2f0300 into main Feb 21, 2024
4 checks passed
@takasehideki takasehideki deleted the pojiro/0.2.0-dev branch February 21, 2024 00:50
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

Successfully merging this pull request may close these issues.

3 participants