Skip to content

Commit

Permalink
完善文档
Browse files Browse the repository at this point in the history
  • Loading branch information
CC11001100 committed Aug 6, 2023
1 parent a8a2075 commit 0dd8839
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 20 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/golang.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Go package

on:
pull_request:
push:

jobs:
build:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19'

- name: Build
run: go build -v ./...

- name: Test
run: go test -v ./...
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Storage Lock Factory

# 一、这是什么

把Storage Lock的创建过程工厂化

# 二、安装依赖

```bash
go get -u github.com/storage-lock/go-storage-lock-factory
```


14 changes: 9 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,23 @@ module github.com/storage-lock/go-storage-lock-factory

go 1.19

require (
github.com/storage-lock/go-storage v0.0.1
github.com/storage-lock/go-storage-lock v0.0.1
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/golang-infrastructure/go-goroutine-id v0.0.0-20230331174358-98b48a64077b // indirect
github.com/golang-infrastructure/go-iterator v0.0.0-20230524171120-56988a9b127c // indirect
github.com/golang-infrastructure/go-pointer v0.0.5 // indirect
github.com/golang-infrastructure/go-reflect-utils v0.0.0-20221130143747-965ef2eb09c3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/storage-lock/go-events v0.0.0-20230805113632-ff4385b14030 // indirect
github.com/storage-lock/go-storage v0.0.0-20230805070648-ce1105955864 // indirect
github.com/storage-lock/go-storage-events v0.0.0-20230805074431-3c9e83cd7acb // indirect
github.com/storage-lock/go-storage-lock v0.0.0-20230806063848-33d8f297b1c7 // indirect
github.com/storage-lock/go-utils v0.0.0-20230804131655-6dbe431cdc1a // indirect
github.com/storage-lock/go-events v0.0.1 // indirect
github.com/storage-lock/go-storage-events v0.0.1 // indirect
github.com/storage-lock/go-utils v0.0.2 // indirect
github.com/stretchr/testify v1.8.4 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
26 changes: 16 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang-infrastructure/go-goroutine-id v0.0.0-20230331174358-98b48a64077b h1:kt3zNiijgkfPm47YaL4MaQJkw0T7ukEEttnCQMOcWxo=
Expand All @@ -10,20 +11,25 @@ github.com/golang-infrastructure/go-reflect-utils v0.0.0-20221130143747-965ef2eb
github.com/golang-infrastructure/go-reflect-utils v0.0.0-20221130143747-965ef2eb09c3/go.mod h1:zqXYxqOBa1mL2ilBK6PuH/Wb/Iego7en6XhiKWdZQHI=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/storage-lock/go-events v0.0.0-20230805113632-ff4385b14030 h1:ET3kiNlDgAMW/8WKHUGcpb4GzeQSuGnW4xta2Ri/jgY=
github.com/storage-lock/go-events v0.0.0-20230805113632-ff4385b14030/go.mod h1:LGZzW3f+td+b+i1pphoI9Dge0kDsguFza/YkXLADet0=
github.com/storage-lock/go-storage v0.0.0-20230805070648-ce1105955864 h1:0lsu6eydV3zLSPdH4aYrQ3kJ2Tjllac8xzOhIQ5xud0=
github.com/storage-lock/go-storage v0.0.0-20230805070648-ce1105955864/go.mod h1:zJZ0g3C6YyDLxX0T/+vxTiVVXZ449LNiFLNBs535a6E=
github.com/storage-lock/go-storage-events v0.0.0-20230805074431-3c9e83cd7acb h1:GuAN/qYQi03ucN7QEUxZvo8Q+CAF5N53HoWAwUBGxmk=
github.com/storage-lock/go-storage-events v0.0.0-20230805074431-3c9e83cd7acb/go.mod h1:6a+wteTwNtzVLBEUA8pECe2/2UtkK+wS0tjlnrEHp9k=
github.com/storage-lock/go-storage-lock v0.0.0-20230806063848-33d8f297b1c7 h1:0i+jz+Dr2xON3CjM975qyzGMv75fJHqiyLRrtFDMt/w=
github.com/storage-lock/go-storage-lock v0.0.0-20230806063848-33d8f297b1c7/go.mod h1:mtvTCnwMiwIHctDYkUNOIUKEJSJyIefPuPPUFLJtt0c=
github.com/storage-lock/go-utils v0.0.0-20230804131655-6dbe431cdc1a h1:6nSZOPYmogTELlp3ZUmzTbOupdrH7OomezDMKHnSAzA=
github.com/storage-lock/go-utils v0.0.0-20230804131655-6dbe431cdc1a/go.mod h1:V0M52rFAkNt77MA3odRqwkl1xRkswsEcX/neFbgmhZY=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/storage-lock/go-events v0.0.1 h1:8abGhlhmJGzn8Pq/LjAbPfAyGs70ZNjwoc7/OITMmUg=
github.com/storage-lock/go-events v0.0.1/go.mod h1:DKwPgfuq8T8CyPLipH+0XHsNt8hEN4g9krUGfosU2oY=
github.com/storage-lock/go-storage v0.0.1 h1:BmIoykW2elNnw5EircFroo353YoIudLXO6LhOuk3xYs=
github.com/storage-lock/go-storage v0.0.1/go.mod h1:tfqgPpnU+NQrcor2WQL4XIbhux4vfue9XzT9ETTd5Ig=
github.com/storage-lock/go-storage-events v0.0.1 h1:NIwf0u8HEzY6Azw2wukvMQLglN5r4xPS/AcjUJiZ1qc=
github.com/storage-lock/go-storage-events v0.0.1/go.mod h1:Ph6p2Nbi5VuB0aGRRIBNkn5G3xvSyhZIEqhRf3gc12Y=
github.com/storage-lock/go-storage-lock v0.0.1 h1:60lvEHQkSqbn0kJY930ZyaygHRz8aIbxHWNSST32ctg=
github.com/storage-lock/go-storage-lock v0.0.1/go.mod h1:SVAbvdYubsZHm8/MgPHKjsHuKLSERB00+clT/QLzoMM=
github.com/storage-lock/go-utils v0.0.2 h1:pdacTOlD+AHqwWVmDqZLcjKF+7p8TjsmlvZ9bmmkIfE=
github.com/storage-lock/go-utils v0.0.2/go.mod h1:tx8ATHL7yOC0Nyjpba7hJNk0+QNt2XEnMr8NcGm9Gak=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
8 changes: 4 additions & 4 deletions storage_lock_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ func (x *StorageLockFactory[Connection]) CreateLockWithOptions(lockId string, op

func (x *StorageLockFactory[Connection]) Shutdown(ctx context.Context) error {

// 关闭连接管理器
if err := x.ConnectionManager.Shutdown(ctx); err != nil {
// 关闭Storage
if err := x.Storage.Close(ctx); err != nil {
return err
}

// 关闭Storage
if err := x.Storage.Close(ctx); err != nil {
// 关闭连接管理器
if err := x.ConnectionManager.Shutdown(ctx); err != nil {
return err
}

Expand Down

0 comments on commit 0dd8839

Please sign in to comment.