Skip to content

Commit

Permalink
Replace channel2 with updated (intermediate) channel API. Add GH acti…
Browse files Browse the repository at this point in the history
…ons and readme
  • Loading branch information
plorenz committed Jan 21, 2022
1 parent 0fe1c2b commit 5b0ce81
Show file tree
Hide file tree
Showing 59 changed files with 1,573 additions and 4,426 deletions.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# see:
# https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-on-github/about-code-owners
* @openziti/maintainers

7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 10
40 changes: 40 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: build

on:
push:
branches:
- main
- release-*
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-18.04
steps:
- name: Git Checkout
uses: actions/checkout@v2
with:
persist-credentials: false

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '~1.17.0'

- name: Install Ziti CI
uses: netfoundry/ziti-ci@v1

- name: Build and Test
run: |
go test ./...
- name: Release
env:
gh_ci_key: ${{ secrets.GH_CI_KEY }}
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release-')
run: |
$(go env GOPATH)/bin/ziti-ci configure-git
$(go env GOPATH)/bin/ziti-ci tag -v -f version
$(go env GOPATH)/bin/ziti-ci trigger-github-build openziti/fabric update-dependency --token ${{ secrets.ZITI_CI_GH_TOKEN }}
$(go env GOPATH)/bin/ziti-ci trigger-github-build openziti/sdk-golang update-dependency --token ${{ secrets.ZITI_CI_GH_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/mattermost-ziti-webhook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: mattermost-ziti-webhook
on:
create:
delete:
issues:
issue_comment:
pull_request_review:
pull_request_review_comment:
pull_request:
push:
fork:
release:

jobs:
mattermost-ziti-webhook:
runs-on: macos-latest
name: POST Webhook
steps:
- uses: openziti/ziti-webhook-action@main
with:
ziti-id: ${{ secrets.ZITI_MATTERMOST_IDENTITY }}
webhook-url: ${{ secrets.ZITI_MATTERMOST_WEBHOOK_URL }}
webhook-secret: ${{ secrets.ZITI_MATTERMOSTI_WEBHOOK_SECRET }}
38 changes: 38 additions & 0 deletions .github/workflows/update-dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: update-dependency
on:
workflow_dispatch:
inputs:
updated-dependency:
description: The dependency that was updated
required: true

jobs:
build:
if: github.ref == 'refs/heads/update-dependency'
runs-on: ubuntu-18.04
steps:
- name: Git Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '~1.17.0'

- name: Install Ziti CI
uses: netfoundry/ziti-ci@v1

- name: Update Dependency
env:
gh_ci_key: ${{ secrets.GH_CI_KEY }}
run: |
$(go env GOPATH)/bin/ziti-ci configure-git
$(go env GOPATH)/bin/ziti-ci update-go-dependency ${{ github.event.inputs.updated-dependency }}
- name: Build and Test
run: go test ./...

- name: Complete Dependency Update
run: $(go env GOPATH)/bin/ziti-ci complete-update-go-dependency
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Channel
channel is a binary message framework. It includes the following features:

* Supports registering message type handlers
* Supports request/response pattern as well as unidirectional message streams
* Allows plugging observers to enable metrics and other use cases
* Async or sync patterns
* Protobufs supported but not required
34 changes: 22 additions & 12 deletions channel.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package channel

import (
"context"
"crypto/x509"
"github.com/openziti/foundation/identity/identity"
"github.com/openziti/foundation/transport"
Expand All @@ -38,6 +39,25 @@ type Channel interface {
GetTimeSinceLastRead() time.Duration
}

type SendContext interface {
Msg() *Message
Priority() Priority
WithPriority(p Priority) SendContext
Context() context.Context
WithTimeout(duration time.Duration) TimeoutSendContext
NotifyBeforeWrite()
NotifyAfterWrite()
NotifyErr(err error)
ReplyChan() chan<- *Message
}

type TimeoutSendContext interface {
SendContext
SendAndWaitForWire(ch Channel) error
SendForReply(ch Channel) (*Message, error)
SendForTypedReply(ch Channel, result TypedMessage) error
}

type Identity interface {
// The TokenId used to represent the identity of this channel to lower-level resources.
//
Expand Down Expand Up @@ -86,21 +106,11 @@ type Underlay interface {
io.Closer
IsClosed() bool
Headers() map[int32][]byte
SetWriteTimeout(duration time.Duration) error
}

type Sender interface {
Send(m *Message) error
SendWithPriority(m *Message, p Priority) error
SendAndSync(m *Message) (chan error, error)
SendAndSyncWithPriority(m *Message, p Priority) (chan error, error)
SendWithTimeout(m *Message, timeout time.Duration) error
SendPrioritizedWithTimeout(m *Message, p Priority, timeout time.Duration) error
SendAndWaitWithTimeout(m *Message, timeout time.Duration) (*Message, error)
SendPrioritizedAndWaitWithTimeout(m *Message, p Priority, timeout time.Duration) (*Message, error)
SendAndWait(m *Message) (chan *Message, error)
SendAndWaitWithPriority(m *Message, p Priority) (chan *Message, error)
SendForReply(msg TypedMessage, timeout time.Duration) (*Message, error)
SendForReplyAndDecode(msg TypedMessage, timeout time.Duration, result TypedMessage) error
Send(sendCtx SendContext) error
}

const AnyContentType = -1
Expand Down
125 changes: 0 additions & 125 deletions channel/channel.go

This file was deleted.

Loading

0 comments on commit 5b0ce81

Please sign in to comment.