Skip to content

Commit 451500b

Browse files
authored
feat: add directory structure to readme and improve structure (#132)
Signed-off-by: Zike Yang <zike@apache.org>
1 parent b38b7e2 commit 451500b

File tree

12 files changed

+60
-37
lines changed

12 files changed

+60
-37
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ integration with Apache Pulsar, allowing users to take full advantage of its rob
4545
executing code across different hardware architectures seamlessly. It provides compatibility and portability,
4646
allowing developers to run their code on various platforms without concerns about underlying hardware dependencies.
4747

48-
### Architecture and Components
48+
## Architecture and Components
4949

5050
Function Stream is composed of three main components: the WebAssembly runtime engine, the Pulsar client, and the
5151
Function Stream service. The following figure shows the overview of the Function Stream architecture.
@@ -64,6 +64,29 @@ and the processing guarantees of the messages.
6464

6565
**The Function Stream service** is responsible for managing the lifecycle and coordination of the WebAssembly instances.
6666

67+
## Directory Structure
68+
69+
The Function Stream project is organized as follows:
70+
.
71+
├── LICENSE # The license for Function Stream
72+
├── Makefile # Contains build automation and commands
73+
├── README.md # README file for the project
74+
├── benchmark # Contains benchmarking tools or results
75+
├── bin # Contains compiled binary files
76+
├── cmd # Contains the command line executable source files
77+
├── common # Contains common utilities and libraries used across the project
78+
├── docs # Documentation for the project
79+
├── examples # Example configurations, scripts, and other reference materials
80+
├── go.mod # Defines the module's module path and its dependency requirements
81+
├── go.sum # Contains the expected cryptographic checksums of the content of specific module versions
82+
├── fs # Core library files for Function Stream
83+
├── license-checker # Tools related to checking license compliance
84+
├── openapi.yaml # API definition file
85+
├── perf # Performance testing scripts
86+
├── restclient # REST client library
87+
├── server # Server-side application source files
88+
└── tests # Contains test scripts and test data
89+
6790
## Building Instructions
6891

6992
To compile Function Stream, use this command:

benchmark/bench_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ import (
2121
"github.com/apache/pulsar-client-go/pulsaradmin"
2222
"github.com/apache/pulsar-client-go/pulsaradmin/pkg/utils"
2323
"github.com/functionstream/functionstream/common"
24-
"github.com/functionstream/functionstream/lib"
25-
"github.com/functionstream/functionstream/lib/contube"
24+
"github.com/functionstream/functionstream/fs"
25+
"github.com/functionstream/functionstream/fs/contube"
2626
"github.com/functionstream/functionstream/perf"
2727
"github.com/functionstream/functionstream/restclient"
2828
"github.com/functionstream/functionstream/server"
@@ -103,9 +103,9 @@ func BenchmarkStressForBasicFunc(b *testing.B) {
103103
func BenchmarkStressForBasicFuncWithMemoryQueue(b *testing.B) {
104104
memoryQueueFactory := contube.NewMemoryQueueFactory(context.Background())
105105

106-
svrConf := &lib.Config{
106+
svrConf := &fs.Config{
107107
ListenAddr: common.DefaultAddr,
108-
QueueBuilder: func(ctx context.Context, config *lib.Config) (contube.TubeFactory, error) {
108+
QueueBuilder: func(ctx context.Context, config *fs.Config) (contube.TubeFactory, error) {
109109
return memoryQueueFactory, nil
110110
},
111111
}
@@ -130,7 +130,7 @@ func BenchmarkStressForBasicFuncWithMemoryQueue(b *testing.B) {
130130
Output: outputTopic,
131131
Replicas: &replicas,
132132
},
133-
QueueBuilder: func(ctx context.Context, c *lib.Config) (contube.TubeFactory, error) {
133+
QueueBuilder: func(ctx context.Context, c *fs.Config) (contube.TubeFactory, error) {
134134
return memoryQueueFactory, nil
135135
},
136136
}

lib/config.go renamed to fs/config.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
package lib
17+
package fs
1818

1919
import (
2020
"context"
21-
"github.com/functionstream/functionstream/lib/contube"
21+
"github.com/functionstream/functionstream/fs/contube"
2222
)
2323

2424
type QueueBuilder func(ctx context.Context, config *Config) (contube.TubeFactory, error)

lib/instance.go renamed to fs/instance.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
package lib
17+
package fs
1818

1919
import (
2020
"context"
2121
"fmt"
2222
"github.com/functionstream/functionstream/common"
2323
"github.com/functionstream/functionstream/common/model"
24-
"github.com/functionstream/functionstream/lib/contube"
24+
"github.com/functionstream/functionstream/fs/contube"
2525
"github.com/pkg/errors"
2626
"github.com/sirupsen/logrus"
2727
"github.com/tetratelabs/wazero"

lib/manager.go renamed to fs/manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
* limitations under the License.
1515
*/
1616

17-
package lib
17+
package fs
1818

1919
import (
2020
"context"
2121
"github.com/functionstream/functionstream/common"
2222
"github.com/functionstream/functionstream/common/model"
23-
"github.com/functionstream/functionstream/lib/contube"
23+
"github.com/functionstream/functionstream/fs/contube"
2424
"log/slog"
2525
"math/rand"
2626
"strconv"

perf/perf.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"fmt"
2323
"github.com/bmizerany/perks/quantile"
2424
"github.com/functionstream/functionstream/common"
25-
"github.com/functionstream/functionstream/lib"
26-
"github.com/functionstream/functionstream/lib/contube"
25+
"github.com/functionstream/functionstream/fs"
26+
"github.com/functionstream/functionstream/fs/contube"
2727
"github.com/functionstream/functionstream/restclient"
2828
"golang.org/x/time/rate"
2929
"log/slog"
@@ -38,7 +38,7 @@ type Config struct {
3838
PulsarURL string
3939
RequestRate float64
4040
Func *restclient.Function
41-
QueueBuilder lib.QueueBuilder
41+
QueueBuilder fs.QueueBuilder
4242
}
4343

4444
type Perf interface {
@@ -49,15 +49,15 @@ type perf struct {
4949
config *Config
5050
input chan<- contube.Record
5151
output <-chan contube.Record
52-
queueBuilder lib.QueueBuilder
52+
queueBuilder fs.QueueBuilder
5353
}
5454

5555
func New(config *Config) Perf {
5656
p := &perf{
5757
config: config,
5858
}
5959
if config.QueueBuilder == nil {
60-
p.queueBuilder = func(ctx context.Context, c *lib.Config) (contube.TubeFactory, error) {
60+
p.queueBuilder = func(ctx context.Context, c *fs.Config) (contube.TubeFactory, error) {
6161
return contube.NewPulsarEventQueueFactory(ctx, (&contube.PulsarTubeFactoryConfig{
6262
PulsarURL: config.PulsarURL,
6363
}).ToConfigMap())
@@ -92,7 +92,7 @@ func (p *perf) Run(ctx context.Context) {
9292
}
9393
}
9494

95-
config := &lib.Config{
95+
config := &fs.Config{
9696
PulsarURL: p.config.PulsarURL,
9797
}
9898

server/config_loader.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ package server
1919
import (
2020
"context"
2121
"github.com/functionstream/functionstream/common"
22-
"github.com/functionstream/functionstream/lib/contube"
22+
"github.com/functionstream/functionstream/fs/contube"
2323
"log/slog"
2424
"os"
2525
"sync"
2626

27-
"github.com/functionstream/functionstream/lib"
27+
"github.com/functionstream/functionstream/fs"
2828
)
2929

30-
var loadedConfig *lib.Config
30+
var loadedConfig *fs.Config
3131
var initConfig = sync.Once{}
3232

33-
func LoadConfigFromEnv() *lib.Config {
33+
func LoadConfigFromEnv() *fs.Config {
3434
initConfig.Do(func() {
35-
loadedConfig = &lib.Config{
35+
loadedConfig = &fs.Config{
3636
ListenAddr: getEnvWithDefault("LISTEN_ADDR", common.DefaultAddr),
3737
PulsarURL: getEnvWithDefault("PULSAR_URL", common.DefaultPulsarURL),
3838
}
3939
queueType := getEnvWithDefault("QUEUE_TYPE", common.DefaultQueueType)
4040
switch queueType {
4141
case common.PulsarQueueType:
42-
loadedConfig.QueueBuilder = func(ctx context.Context, c *lib.Config) (contube.TubeFactory, error) {
42+
loadedConfig.QueueBuilder = func(ctx context.Context, c *fs.Config) (contube.TubeFactory, error) {
4343
return contube.NewPulsarEventQueueFactory(ctx, (&contube.PulsarTubeFactoryConfig{
4444
PulsarURL: c.PulsarURL,
4545
}).ToConfigMap())
@@ -49,12 +49,12 @@ func LoadConfigFromEnv() *lib.Config {
4949
return loadedConfig
5050
}
5151

52-
func LoadStandaloneConfigFromEnv() *lib.Config {
52+
func LoadStandaloneConfigFromEnv() *fs.Config {
5353
initConfig.Do(func() {
54-
loadedConfig = &lib.Config{
54+
loadedConfig = &fs.Config{
5555
ListenAddr: getEnvWithDefault("LISTEN_ADDR", common.DefaultAddr),
5656
}
57-
loadedConfig.QueueBuilder = func(ctx context.Context, c *lib.Config) (contube.TubeFactory, error) {
57+
loadedConfig.QueueBuilder = func(ctx context.Context, c *fs.Config) (contube.TubeFactory, error) {
5858
return contube.NewMemoryQueueFactory(ctx), nil
5959
}
6060
})

0 commit comments

Comments
 (0)