Skip to content
This repository has been archived by the owner on Sep 19, 2024. It is now read-only.

Commit

Permalink
refactor: adjust the socket suffix
Browse files Browse the repository at this point in the history
address #92

BREAKING CHANGE: change the socket file name with `.sock` suffix.
  • Loading branch information
Frank Mai authored and guangbochen committed Jun 12, 2020
1 parent cbca97a commit ff4ebb8
Show file tree
Hide file tree
Showing 18 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion adaptors/ble/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This is BLE(Bluetooth Low Energy) adaptor is used for bluetooth devices connecti

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/ble` | `ble.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/ble` | `ble.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion adaptors/ble/pkg/ble/ble.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/ble"
Version = "v1alpha1"
Endpoint = "ble.socket"
Endpoint = "ble.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=bluetoothdevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion adaptors/dummy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This is for experience or testing.

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/dummy` | `dummy.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/dummy` | `dummy.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion adaptors/dummy/pkg/dummy/dummy.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/dummy"
Version = "v1alpha1"
Endpoint = "dummy.socket"
Endpoint = "dummy.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=dummyspecialdevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion adaptors/modbus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Modbus Adaptor supports TCP and RTU protocol.

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/modbus` | `modbus.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/modbus` | `modbus.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion adaptors/modbus/pkg/modbus/modbus.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/modbus"
Version = "v1alpha1"
Endpoint = "modbus.socket"
Endpoint = "modbus.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=modbusdevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion adaptors/mqtt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/mqtt` | `mqtt.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/mqtt` | `mqtt.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion adaptors/mqtt/pkg/mqtt/mqtt.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/mqtt"
Version = "v1alpha1"
Endpoint = "mqtt.socket"
Endpoint = "mqtt.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=mqttdevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion adaptors/opcua/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ OPCUA Adaptor is used for connecting to and manipulating opcua devices on the ed

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/opcua` | `opcua.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/opcua` | `opcua.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion adaptors/opcua/pkg/opcua/opcua.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/opcua"
Version = "v1alpha1"
Endpoint = "opcua.socket"
Endpoint = "opcua.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=opcuadevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
4 changes: 2 additions & 2 deletions docs/adaptors/design_of_adaptor.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ Following the below steps can allow an adaptor to interact with `limb`:
string name = 1;
// Version of the API the adaptor was built against.
string version = 2;
// Name of the unix socket the adaptor is listening on, it's in the form `*.socket`.
// Name of the unix socket the adaptor is listening on, it's in the form `*.sock`.
string endpoint = 3;
}
```
Expand Down Expand Up @@ -137,7 +137,7 @@ Following the below steps can allow an adaptor to interact with `limb`:
bytes device = 1;
}
```
1. The adaptor registers itself with the `limb` through the Unix socket at host path `/var/lib/octopus/adaptors/limb.socket`.
1. The adaptor registers itself with the `limb` through the Unix socket at host path `/var/lib/octopus/adaptors/limb.sock`.
1. After successfully registering itself, the adaptor runs in serving mode, during which it keeps connecting devices and reports back to the `limb` upon any device state changes.
#### Registration
Expand Down
2 changes: 1 addition & 1 deletion hack/make-rules/template-adaptor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function entry() {
sed "s#template/adaptor#adaptors/${adaptorNameLowercase}#g" "${adaptorPath}/pkg/adaptor/service.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/adaptor/service.go"
sed "s#template/adaptor#adaptors/${adaptorNameLowercase}#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
sed "s#adaptors.edge.cattle.io/template#adaptors.edge.cattle.io/${adaptorNameLowercase}#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
sed "s#template.socket#${adaptorNameLowercase}.socket#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
sed "s#template.sock#${adaptorNameLowercase}.sock#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
sed "s#package template#package ${adaptorNameLowercase}#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
sed "s#templatedevices#${adaptorNameLowercase}devices#g" "${adaptorPath}/pkg/template/template.go" >"${tmpfile}" && mv "${tmpfile}" "${adaptorPath}/pkg/template/template.go"
mv "${adaptorPath}/pkg/template/template.go" "${adaptorPath}/pkg/template/${adaptorNameLowercase}.go"
Expand Down
2 changes: 1 addition & 1 deletion pkg/adaptor/api/v1alpha1/api.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/adaptor/api/v1alpha1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ message RegisterRequest {
string name = 1;
// Version of the API the adaptor was built against.
string version = 2;
// Name of the unix socket the adaptor is listening on, it's in the form `*.socket`.
// Name of the unix socket the adaptor is listening on, it's in the form `*.sock`.
string endpoint = 3;
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/adaptor/api/v1alpha1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const (
AdaptorPath = "/var/lib/octopus/adaptors/"

// SocketSuffix is the suffix of the socket
SocketSuffix = ".socket"
SocketSuffix = ".sock"

// LimbSocket is the path of the Limb registry socket
LimbSocket = AdaptorPath + "limb" + SocketSuffix
Expand Down
2 changes: 1 addition & 1 deletion template/adaptor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

| Versions | Register Name | Endpoint Socket | Available |
|:---:|:---:|:---:|:---:|
| `v1alpha1` | `adaptors.edge.cattle.io/template` | `template.socket` | * |
| `v1alpha1` | `adaptors.edge.cattle.io/template` | `template.sock` | * |

## Support Model

Expand Down
2 changes: 1 addition & 1 deletion template/adaptor/pkg/template/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
const (
Name = "adaptors.edge.cattle.io/template"
Version = "v1alpha1"
Endpoint = "template.socket"
Endpoint = "template.sock"
)

// +kubebuilder:rbac:groups=devices.edge.cattle.io,resources=templatedevices,verbs=get;list;watch;create;update;patch;delete
Expand Down
2 changes: 1 addition & 1 deletion test/integration/limb/devicelink_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ func (a fakeDummyAdaptor) GetName() string {
}

func (a fakeDummyAdaptor) GetEndpoint() string {
return "dummy.socket"
return "dummy.sock"
}

func (a fakeDummyAdaptor) Stop() error {
Expand Down

0 comments on commit ff4ebb8

Please sign in to comment.