Skip to content

Commit

Permalink
Implement a high-level shadow document interface (#16)
Browse files Browse the repository at this point in the history
* Implement a high-level shadow document interface

* Add JSON compat

* Fix typo

* Export lock,unlock

* Clean up test

* Add lock/unlock test

* Fix shadow unsubscribe

* Remove debug print

* Add missing exports

* Add missing export

* Clean up docs

* dont run tests in parallel

* Fix concurrency groups

* Fix concurrency groups

* Fix concurrency groups

* debug

* debug

* debug

* Remove serialization for now. Will fix in another PR

* Fix documentation typos

* Document when tasks may wait forever while offline

* Document that tasks may wait forever before issuing a connect
  • Loading branch information
Octogonapus authored Sep 29, 2023
1 parent 79db7ad commit bbd6653
Show file tree
Hide file tree
Showing 16 changed files with 1,760 additions and 357 deletions.
2 changes: 2 additions & 0 deletions .JuliaFormatter.toml
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
margin = 120
remove_extra_newlines = true
format_docstrings = true
34 changes: 5 additions & 29 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
name: CI

on:
push:
branches:
- main
tags: ["*"]
pull_request:
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

permissions:
contents: read

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand Down Expand Up @@ -73,23 +69,3 @@ jobs:
ENDPOINT: ${{ secrets.ENDPOINT }}
CERT_STRING: ${{ secrets.CERT_STRING }}
PRI_KEY_STRING: ${{ secrets.PRI_KEY_STRING }}
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: julia-actions/setup-julia@v1
with:
version: "1"
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
- run: |
julia --project=docs -e '
using Documenter: DocMeta, doctest
using AWSCRT
DocMeta.setdocmeta!(AWSCRT, :DocTestSetup, :(using AWSCRT); recursive=true)
doctest(AWSCRT)'
19 changes: 19 additions & 0 deletions .github/workflows/Documenter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Documenter
on:
push:
branches: [main]
tags: [v*]
pull_request:

jobs:
Documenter:
permissions:
contents: write
name: Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: julia-actions/julia-buildpkg@v1
- uses: julia-actions/julia-docdeploy@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ log.txt

# Built Visual Studio Code Extensions
*.vsix

.env
4 changes: 3 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
name = "AWSCRT"
uuid = "df31ea59-17a4-4ebd-9d69-4f45266dc2c7"
version = "0.1.2"
version = "0.1.3"

[deps]
AWSCRT_jll = "01db5350-6ea1-5d9a-9a47-8a31a394cb9c"
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
CountDownLatches = "621fb831-fdad-4fff-93ac-1af7b7ed19e3"
ForeignCallbacks = "809b5ff2-8730-47bb-8e19-67299d747c44"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
LibAWSCRT = "df7458b6-5204-493f-a0e7-404b4eb72fac"

[compat]
CEnum = "0.4"
CountDownLatches = "2"
ForeignCallbacks = "0.1"
JSON = "0.21"
LibAWSCRT = "0.1"
julia = "1.9"
31 changes: 23 additions & 8 deletions src/AWSCRT.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
"""
Environment variables:
- `AWS_CRT_MEMORY_TRACING`: Set to `0`, `1`, or `2` to enable memory tracing. Default is off. See [`aws_mem_trace_level`](@ref).
- `AWS_CRT_MEMORY_TRACING_FRAMES_PER_STACK`: Set the number of frames per stack for memory tracing. Default is the AWS library's default.
- `AWS_CRT_LOG_LEVEL`: Set to `0` through `6` to enable logging. Default is off. See [`aws_log_level`](@ref).
- `AWS_CRT_LOG_PATH`: Set to the log file path. Must be set if `AWS_CRT_LOG_LEVEL` is set.
- `AWS_CRT_MEMORY_TRACING`: Set to `0`, `1`, or `2` to enable memory tracing. Default is off. See [`aws_mem_trace_level`](@ref).
- `AWS_CRT_MEMORY_TRACING_FRAMES_PER_STACK`: Set the number of frames per stack for memory tracing. Default is the AWS library's default.
- `AWS_CRT_LOG_LEVEL`: Set to `0` through `6` to enable logging. Default is off. See [`aws_log_level`](@ref).
- `AWS_CRT_LOG_PATH`: Set to the log file path. Must be set if `AWS_CRT_LOG_LEVEL` is set.
Note: all the symbols in this package that begin with underscores are private and are not part of this package's published interface. Please don't use them.
"""
module AWSCRT

using LibAWSCRT, ForeignCallbacks, CountDownLatches, CEnum
using LibAWSCRT, ForeignCallbacks, CountDownLatches, CEnum, JSON
import Base: lock, unlock
export lock, unlock

const _AWSCRT_ALLOCATOR = Ref{Union{Ptr{aws_allocator},Nothing}}(nothing)
const _GLOBAL_REFS = Vector{Ref}()
Expand Down Expand Up @@ -83,9 +88,10 @@ end

aws_err_string(code = aws_last_error()) = "AWS Error $code: " * Base.unsafe_string(aws_error_debug_str(code))

const advanced_use_note = "Note on advanced use: the internal constructor on this struct has been left at its " *
"default so that you can bring your own native data if you need to. However, you are then responsible for the " *
"memory management of that data."
const advanced_use_note =
"Note on advanced use: the internal constructor on this struct has been left at its " *
"default so that you can bring your own native data if you need to. However, you are then responsible for the " *
"memory management of that data."

include("AWSIO.jl")
export EventLoopGroup
Expand Down Expand Up @@ -118,5 +124,14 @@ export publish

include("IOTShadow.jl")
export ShadowClient
export OnShadowMessage

include("ShadowFramework.jl")
export ShadowFramework
export ShadowDocumentPropertyUpdateCallback
export ShadowDocumentPreUpdateCallback
export ShadowDocumentPostUpdateCallback
export shadow_client
export publish_current_state

end
Loading

2 comments on commit bbd6653

@Octogonapus
Copy link
Owner Author

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/92678

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.3 -m "<description of version>" bbd6653f4fbe5cd71b63f4f0035081b985cbd7fe
git push origin v0.1.3

Please sign in to comment.