Skip to content

Commit

Permalink
Apply lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sejongk committed Sep 6, 2023
1 parent b59928d commit 0b1dd74
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pkg/document/document.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (d *Document) BroadcastRequests() <-chan BroadcastRequest {

// Broadcast encodes the payload and makes a "Broadcast" type request.
func (d *Document) Broadcast(eventType string, payload any) error {
if eventType == "document" {
if isEventTypeReserved(eventType) {
return ErrReservedEventType
}

Expand All @@ -407,7 +407,7 @@ func (d *Document) SubscribeBroadcastEvent(
eventType string,
handler func(eventType, publisher string, payload []byte) error,
) error {
if eventType == "document" {
if isEventTypeReserved(eventType) {
return ErrReservedEventType
}

Expand All @@ -425,7 +425,7 @@ func (d *Document) SubscribeBroadcastEvent(
func (d *Document) UnsubscribeBroadcastEvent(
eventType string,
) error {
if eventType == "document" {
if isEventTypeReserved(eventType) {
return ErrReservedEventType
}

Expand Down Expand Up @@ -460,3 +460,10 @@ func messageFromMsgAndArgs(msgAndArgs ...interface{}) string {
}
return ""
}

func isEventTypeReserved(eventType string) bool {
if eventType == "document" {
return true
}
return false
}

1 comment on commit 0b1dd74

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Go Benchmark

Benchmark suite Current: 0b1dd74 Previous: 8b2a9a7 Ratio
BenchmarkDocument/constructor_test - ns/op 1649 ns/op 1645 ns/op 1.00
BenchmarkDocument/constructor_test - B/op 1144 B/op 1144 B/op 1
BenchmarkDocument/constructor_test - allocs/op 18 allocs/op 18 allocs/op 1
BenchmarkDocument/status_test - ns/op 1544 ns/op 1036 ns/op 1.49
BenchmarkDocument/status_test - B/op 1112 B/op 1112 B/op 1
BenchmarkDocument/status_test - allocs/op 16 allocs/op 16 allocs/op 1
BenchmarkDocument/equals_test - ns/op 9249 ns/op 9056 ns/op 1.02
BenchmarkDocument/equals_test - B/op 6720 B/op 6720 B/op 1
BenchmarkDocument/equals_test - allocs/op 113 allocs/op 113 allocs/op 1
BenchmarkDocument/nested_update_test - ns/op 22406 ns/op 23725 ns/op 0.94
BenchmarkDocument/nested_update_test - B/op 11897 B/op 11897 B/op 1
BenchmarkDocument/nested_update_test - allocs/op 251 allocs/op 251 allocs/op 1
BenchmarkDocument/delete_test - ns/op 29819 ns/op 29089 ns/op 1.03
BenchmarkDocument/delete_test - B/op 15122 B/op 15122 B/op 1
BenchmarkDocument/delete_test - allocs/op 330 allocs/op 330 allocs/op 1
BenchmarkDocument/object_test - ns/op 10914 ns/op 10382 ns/op 1.05
BenchmarkDocument/object_test - B/op 6657 B/op 6657 B/op 1
BenchmarkDocument/object_test - allocs/op 113 allocs/op 113 allocs/op 1
BenchmarkDocument/array_test - ns/op 36757 ns/op 34925 ns/op 1.05
BenchmarkDocument/array_test - B/op 11754 B/op 11754 B/op 1
BenchmarkDocument/array_test - allocs/op 267 allocs/op 267 allocs/op 1
BenchmarkDocument/text_test - ns/op 40047 ns/op 38657 ns/op 1.04
BenchmarkDocument/text_test - B/op 14826 B/op 14826 B/op 1
BenchmarkDocument/text_test - allocs/op 473 allocs/op 473 allocs/op 1
BenchmarkDocument/text_composition_test - ns/op 39388 ns/op 38208 ns/op 1.03
BenchmarkDocument/text_composition_test - B/op 18210 B/op 18210 B/op 1
BenchmarkDocument/text_composition_test - allocs/op 474 allocs/op 474 allocs/op 1
BenchmarkDocument/rich_text_test - ns/op 103394 ns/op 102400 ns/op 1.01
BenchmarkDocument/rich_text_test - B/op 37015 B/op 37016 B/op 1.00
BenchmarkDocument/rich_text_test - allocs/op 1134 allocs/op 1134 allocs/op 1
BenchmarkDocument/counter_test - ns/op 21906 ns/op 21823 ns/op 1.00
BenchmarkDocument/counter_test - B/op 10177 B/op 10178 B/op 1.00
BenchmarkDocument/counter_test - allocs/op 238 allocs/op 238 allocs/op 1
BenchmarkDocument/text_edit_gc_100 - ns/op 4050418 ns/op 3919058 ns/op 1.03
BenchmarkDocument/text_edit_gc_100 - B/op 1553185 B/op 1553500 B/op 1.00
BenchmarkDocument/text_edit_gc_100 - allocs/op 17164 allocs/op 17166 allocs/op 1.00
BenchmarkDocument/text_edit_gc_1000 - ns/op 322191815 ns/op 305822693 ns/op 1.05
BenchmarkDocument/text_edit_gc_1000 - B/op 136643872 B/op 136666284 B/op 1.00
BenchmarkDocument/text_edit_gc_1000 - allocs/op 210756 allocs/op 210879 allocs/op 1.00
BenchmarkDocument/text_split_gc_100 - ns/op 4669850 ns/op 4461948 ns/op 1.05
BenchmarkDocument/text_split_gc_100 - B/op 2217759 B/op 2218207 B/op 1.00
BenchmarkDocument/text_split_gc_100 - allocs/op 16591 allocs/op 16595 allocs/op 1.00
BenchmarkDocument/text_split_gc_1000 - ns/op 389201189 ns/op 357452373 ns/op 1.09
BenchmarkDocument/text_split_gc_1000 - B/op 214851058 B/op 214840861 B/op 1.00
BenchmarkDocument/text_split_gc_1000 - allocs/op 211390 allocs/op 211342 allocs/op 1.00
BenchmarkDocument/text_delete_all_10000 - ns/op 17123304 ns/op 17519738 ns/op 0.98
BenchmarkDocument/text_delete_all_10000 - B/op 5902337 B/op 5905240 B/op 1.00
BenchmarkDocument/text_delete_all_10000 - allocs/op 41117 allocs/op 41131 allocs/op 1.00
BenchmarkDocument/text_delete_all_100000 - ns/op 201409080 ns/op 239749099 ns/op 0.84
BenchmarkDocument/text_delete_all_100000 - B/op 53839193 B/op 53858656 B/op 1.00
BenchmarkDocument/text_delete_all_100000 - allocs/op 415990 allocs/op 416083 allocs/op 1.00
BenchmarkDocument/text_100 - ns/op 312877 ns/op 313643 ns/op 1.00
BenchmarkDocument/text_100 - B/op 118421 B/op 118421 B/op 1
BenchmarkDocument/text_100 - allocs/op 5077 allocs/op 5077 allocs/op 1
BenchmarkDocument/text_1000 - ns/op 3380827 ns/op 3457317 ns/op 0.98
BenchmarkDocument/text_1000 - B/op 1153024 B/op 1153025 B/op 1.00
BenchmarkDocument/text_1000 - allocs/op 50081 allocs/op 50081 allocs/op 1
BenchmarkDocument/array_1000 - ns/op 1747340 ns/op 1713545 ns/op 1.02
BenchmarkDocument/array_1000 - B/op 1102987 B/op 1103084 B/op 1.00
BenchmarkDocument/array_1000 - allocs/op 11870 allocs/op 11871 allocs/op 1.00
BenchmarkDocument/array_10000 - ns/op 19057058 ns/op 19152387 ns/op 1.00
BenchmarkDocument/array_10000 - B/op 9908300 B/op 9906093 B/op 1.00
BenchmarkDocument/array_10000 - allocs/op 120727 allocs/op 120718 allocs/op 1.00
BenchmarkDocument/array_gc_100 - ns/op 183227 ns/op 176825 ns/op 1.04
BenchmarkDocument/array_gc_100 - B/op 98368 B/op 98364 B/op 1.00
BenchmarkDocument/array_gc_100 - allocs/op 1246 allocs/op 1246 allocs/op 1
BenchmarkDocument/array_gc_1000 - ns/op 2014679 ns/op 1937102 ns/op 1.04
BenchmarkDocument/array_gc_1000 - B/op 1170652 B/op 1170600 B/op 1.00
BenchmarkDocument/array_gc_1000 - allocs/op 12909 allocs/op 12909 allocs/op 1
BenchmarkDocument/counter_1000 - ns/op 277479 ns/op 289151 ns/op 0.96
BenchmarkDocument/counter_1000 - B/op 198740 B/op 198740 B/op 1
BenchmarkDocument/counter_1000 - allocs/op 6506 allocs/op 6506 allocs/op 1
BenchmarkDocument/counter_10000 - ns/op 2990640 ns/op 3069618 ns/op 0.97
BenchmarkDocument/counter_10000 - B/op 2165662 B/op 2165685 B/op 1.00
BenchmarkDocument/counter_10000 - allocs/op 69513 allocs/op 69513 allocs/op 1
BenchmarkDocument/object_1000 - ns/op 1898852 ns/op 1774782 ns/op 1.07
BenchmarkDocument/object_1000 - B/op 1451382 B/op 1451444 B/op 1.00
BenchmarkDocument/object_1000 - allocs/op 9917 allocs/op 9918 allocs/op 1.00
BenchmarkDocument/object_10000 - ns/op 21707501 ns/op 22137040 ns/op 0.98
BenchmarkDocument/object_10000 - B/op 12370616 B/op 12370116 B/op 1.00
BenchmarkDocument/object_10000 - allocs/op 101224 allocs/op 101224 allocs/op 1
BenchmarkRPC/client_to_server - ns/op 387085893 ns/op 403586987 ns/op 0.96
BenchmarkRPC/client_to_server - B/op 12290098 B/op 12224802 B/op 1.01
BenchmarkRPC/client_to_server - allocs/op 177830 allocs/op 176918 allocs/op 1.01
BenchmarkRPC/client_to_client_via_server - ns/op 659797205 ns/op 703134840 ns/op 0.94
BenchmarkRPC/client_to_client_via_server - B/op 22582804 B/op 22618076 B/op 1.00
BenchmarkRPC/client_to_client_via_server - allocs/op 330665 allocs/op 331134 allocs/op 1.00
BenchmarkRPC/attach_large_document - ns/op 1523191696 ns/op 1359748878 ns/op 1.12
BenchmarkRPC/attach_large_document - B/op 1798194264 B/op 1799405880 B/op 1.00
BenchmarkRPC/attach_large_document - allocs/op 9521 allocs/op 9590 allocs/op 0.99
BenchmarkRPC/adminCli_to_server - ns/op 563708182 ns/op 598842152 ns/op 0.94
BenchmarkRPC/adminCli_to_server - B/op 21104556 B/op 21103788 B/op 1.00
BenchmarkRPC/adminCli_to_server - allocs/op 333617 allocs/op 333606 allocs/op 1.00
BenchmarkLocker - ns/op 121.4 ns/op 122.4 ns/op 0.99
BenchmarkLocker - B/op 16 B/op 16 B/op 1
BenchmarkLocker - allocs/op 1 allocs/op 1 allocs/op 1
BenchmarkLockerParallel - ns/op 113.6 ns/op 128.7 ns/op 0.88
BenchmarkLockerParallel - B/op 0 B/op 0 B/op NaN
BenchmarkLockerParallel - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkLockerMoreKeys - ns/op 356.8 ns/op 483.6 ns/op 0.74
BenchmarkLockerMoreKeys - B/op 14 B/op 13 B/op 1.08
BenchmarkLockerMoreKeys - allocs/op 0 allocs/op 0 allocs/op NaN
BenchmarkSync/memory_sync_10_test - ns/op 7200 ns/op 7322 ns/op 0.98
BenchmarkSync/memory_sync_10_test - B/op 1285 B/op 1283 B/op 1.00
BenchmarkSync/memory_sync_10_test - allocs/op 38 allocs/op 38 allocs/op 1
BenchmarkSync/memory_sync_100_test - ns/op 59043 ns/op 69765 ns/op 0.85
BenchmarkSync/memory_sync_100_test - B/op 9081 B/op 8737 B/op 1.04
BenchmarkSync/memory_sync_100_test - allocs/op 300 allocs/op 279 allocs/op 1.08
BenchmarkSync/memory_sync_1000_test - ns/op 630942 ns/op 686582 ns/op 0.92
BenchmarkSync/memory_sync_1000_test - B/op 84368 B/op 81819 B/op 1.03
BenchmarkSync/memory_sync_1000_test - allocs/op 2742 allocs/op 2582 allocs/op 1.06
BenchmarkSync/memory_sync_10000_test - ns/op 6987388 ns/op 7139141 ns/op 0.98
BenchmarkSync/memory_sync_10000_test - B/op 867465 B/op 858288 B/op 1.01
BenchmarkSync/memory_sync_10000_test - allocs/op 27886 allocs/op 26871 allocs/op 1.04
BenchmarkTextEditing - ns/op 25306412063 ns/op 27047402085 ns/op 0.94
BenchmarkTextEditing - B/op 8457272000 B/op 8456806024 B/op 1.00
BenchmarkTextEditing - allocs/op 20616100 allocs/op 20613838 allocs/op 1.00

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.