Skip to content

Commit 54002a8

Browse files
committed
feat: support single resource CRUD
1 parent 5c6e00d commit 54002a8

File tree

16 files changed

+498
-362
lines changed

16 files changed

+498
-362
lines changed

docs/architecture.md

Lines changed: 3 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -32,160 +32,9 @@ To optimize execution, two key processes—compilation and runtime—are employe
3232

3333
The engine does not expose an API for directly modifying node specifications. Instead, it focuses on loading, compiling, and activating nodes to make them executable.
3434

35-
Users can update node specifications by using a Command-Line Interface (CLI) or defining workflows that provide an HTTP API for modifications. Typically, these workflows are defined in the `system` namespace.
36-
37-
```yaml
38-
- kind: listener
39-
name: listener
40-
protocol: http
41-
port: '{{ .PORT }}'
42-
ports:
43-
out:
44-
- name: router
45-
port: in
46-
error:
47-
- name: catch
48-
port: in
49-
50-
- kind: router
51-
name: router
52-
routes:
53-
- method: POST
54-
path: /v1/specs
55-
port: out[0]
56-
- method: GET
57-
path: /v1/specs
58-
port: out[1]
59-
- method: PATCH
60-
path: /v1/specs
61-
port: out[2]
62-
- method: DELETE
63-
path: /v1/specs
64-
port: out[3]
65-
ports:
66-
out[0]:
67-
- name: specs_create
68-
port: in
69-
out[1]:
70-
- name: specs_read
71-
port: in
72-
out[2]:
73-
- name: specs_update
74-
port: in
75-
out[3]:
76-
- name: specs_delete
77-
port: in
78-
79-
- kind: block
80-
name: specs_create
81-
specs:
82-
- kind: snippet
83-
language: cel
84-
code: 'has(self.body) ? self.body : null'
85-
- kind: native
86-
opcode: specs.create
87-
- kind: snippet
88-
language: javascript
89-
code: |
90-
export default function (args) {
91-
return {
92-
body: args,
93-
status: 201
94-
};
95-
}
96-
97-
- kind: block
98-
name: specs_read
99-
specs:
100-
- kind: snippet
101-
language: json
102-
code: 'null'
103-
- kind: native
104-
opcode: specs.read
105-
- kind: snippet
106-
language: javascript
107-
code: |
108-
export default function (args) {
109-
return {
110-
body: args,
111-
status: 200
112-
};
113-
}
114-
115-
- kind: block
116-
name: specs_update
117-
specs:
118-
- kind: snippet
119-
language: cel
120-
code: 'has(self.body) ? self.body : null'
121-
- kind: native
122-
opcode: specs.update
123-
- kind: snippet
124-
language: javascript
125-
code: |
126-
export default function (args) {
127-
return {
128-
body: args,
129-
status: 200
130-
};
131-
}
132-
133-
- kind: block
134-
name: specs_delete
135-
specs:
136-
- kind: snippet
137-
language: json
138-
code: 'null'
139-
- kind: native
140-
opcode: specs.delete
141-
- kind: snippet
142-
language: javascript
143-
code: |
144-
export default function (args) {
145-
return {
146-
status: 204
147-
};
148-
}
149-
150-
- kind: switch
151-
name: catch
152-
matches:
153-
- when: self == "unsupported type" || self == "unsupported value"
154-
port: out[0]
155-
- when: 'true'
156-
port: out[1]
157-
ports:
158-
out[0]:
159-
- name: status_400
160-
port: in
161-
out[1]:
162-
- name: status_500
163-
port: in
164-
165-
- kind: snippet
166-
name: status_400
167-
language: javascript
168-
code: |
169-
export default function (args) {
170-
return {
171-
body: {
172-
error: args.error()
173-
},
174-
status: 400
175-
};
176-
}
177-
178-
- kind: snippet
179-
name: status_500
180-
language: json
181-
code: |
182-
{
183-
"body": {
184-
"error": "Internal Server Error"
185-
},
186-
"status": 500
187-
}
188-
```
35+
Users can update node specifications by using a Command-Line Interface (CLI) or
36+
defining [workflows](../examples/system.yaml) that provide an HTTP API for modifications. Typically, these workflows are
37+
defined in the `system` namespace.
18938

19039
This approach ensures runtime stability while allowing flexible system expansion.
19140

docs/architecture_kr.md

Lines changed: 2 additions & 154 deletions
Original file line numberDiff line numberDiff line change
@@ -30,160 +30,8 @@
3030

3131
### 워크플로우 수정
3232

33-
엔진은 사용자에게 노드 명세 변경을 위한 API를 제공하지 않으며, 노드를 로드하고 컴파일하여 실행하는 데 집중합니다. 노드 명세를 수정할 필요가 있을 때는 Command-Line Interface(CLI)나 직접 정의한 워크플로우를 통해 HTTP API로 명세를 업데이트할 수 있습니다. 이러한 워크플로우는 보통 `system` 네임스페이스에 정의됩니다.
34-
35-
```yaml
36-
- kind: listener
37-
name: listener
38-
protocol: http
39-
port: '{{ .PORT }}'
40-
ports:
41-
out:
42-
- name: router
43-
port: in
44-
error:
45-
- name: catch
46-
port: in
47-
48-
- kind: router
49-
name: router
50-
routes:
51-
- method: POST
52-
path: /v1/specs
53-
port: out[0]
54-
- method: GET
55-
path: /v1/specs
56-
port: out[1]
57-
- method: PATCH
58-
path: /v1/specs
59-
port: out[2]
60-
- method: DELETE
61-
path: /v1/specs
62-
port: out[3]
63-
ports:
64-
out[0]:
65-
- name: specs_create
66-
port: in
67-
out[1]:
68-
- name: specs_read
69-
port: in
70-
out[2]:
71-
- name: specs_update
72-
port: in
73-
out[3]:
74-
- name: specs_delete
75-
port: in
76-
77-
- kind: block
78-
name: specs_create
79-
specs:
80-
- kind: snippet
81-
language: cel
82-
code: 'has(self.body) ? self.body : null'
83-
- kind: native
84-
opcode: specs.create
85-
- kind: snippet
86-
language: javascript
87-
code: |
88-
export default function (args) {
89-
return {
90-
body: args,
91-
status: 201
92-
};
93-
}
94-
95-
- kind: block
96-
name: specs_read
97-
specs:
98-
- kind: snippet
99-
language: json
100-
code: 'null'
101-
- kind: native
102-
opcode: specs.read
103-
- kind: snippet
104-
language: javascript
105-
code: |
106-
export default function (args) {
107-
return {
108-
body: args,
109-
status: 200
110-
};
111-
}
112-
113-
- kind: block
114-
name: specs_update
115-
specs:
116-
- kind: snippet
117-
language: cel
118-
code: 'has(self.body) ? self.body : null'
119-
- kind: native
120-
opcode: specs.update
121-
- kind: snippet
122-
language: javascript
123-
code: |
124-
export default function (args) {
125-
return {
126-
body: args,
127-
status: 200
128-
};
129-
}
130-
131-
- kind: block
132-
name: specs_delete
133-
specs:
134-
- kind: snippet
135-
language: json
136-
code: 'null'
137-
- kind: native
138-
opcode: specs.delete
139-
- kind: snippet
140-
language: javascript
141-
code: |
142-
export default function (args) {
143-
return {
144-
status: 204
145-
};
146-
}
147-
148-
- kind: switch
149-
name: catch
150-
matches:
151-
- when: self == "unsupported type" || self == "unsupported value"
152-
port: out[0]
153-
- when: 'true'
154-
port: out[1]
155-
ports:
156-
out[0]:
157-
- name: status_400
158-
port: in
159-
out[1]:
160-
- name: status_500
161-
port: in
162-
163-
- kind: snippet
164-
name: status_400
165-
language: javascript
166-
code: |
167-
export default function (args) {
168-
return {
169-
body: {
170-
error: args.error()
171-
},
172-
status: 400
173-
};
174-
}
175-
176-
- kind: snippet
177-
name: status_500
178-
language: json
179-
code: |
180-
{
181-
"body": {
182-
"error": "Internal Server Error"
183-
},
184-
"status": 500
185-
}
186-
```
33+
엔진은 사용자에게 노드 명세 변경을 위한 API를 제공하지 않으며, 노드를 로드하고 컴파일하여 실행하는 데 집중합니다. 노드 명세를 수정할 필요가 있을 때는 Command-Line Interface(CLI)나 직접
34+
정의한 [워크플로우](../examples/system.yaml)를 통해 HTTP API로 명세를 업데이트할 수 있습니다. 이러한 워크플로우는 보통 `system` 네임스페이스에 정의됩니다.
18735

18836
이 접근 방식은 안정적인 런타임 환경을 유지하면서 시스템을 유연하게 확장할 수 있도록 합니다.
18937

0 commit comments

Comments
 (0)