This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package executor | |
type ExecHandler[T any] func(T) | |
type Executor[T any] struct { | |
reader chan T | |
writer chan T | |
buffer []T | |
execHandler ExecHandler[T] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Attribute definition | |
[ValidationAttribute] | |
[AttributeUsage(AttributeTargets.Parameter)] | |
public class RequiresNotNullAttribute : Attribute { | |
public static Exception? TryValidate<T>(T value, [CallerArgumentExpression("value")] string? ArgumentName = default) { | |
var ret = default(Exception?); | |
if (value == null) { | |
ret = new ArgumentNullException(ArgumentName); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Let me go simple and to the point here. | |
Don't communicate by sharing memory. | |
It is like when your are communicating using threads for example you have to use variables or mutexes to lock memory for not allowing someone to read and write on it until the communication is complete. | |
Share memory by communicating | |
In go routines values move on channels rather than blocking the memory, sender notifies receiver to receive from that channel and hence it share memory by communicating with receiver to get from a channel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eventbuses are useful when you don't want components to depend on each other. | |
Instead of a component having many references to other components, | |
it can just send Events to an Eventbus and does not have to worry about who will take care of them. | |
events are interfaces for commiunicate. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.3' | |
services: | |
db: | |
image: mysql | |
restart: always | |
environment: | |
MYSQL_DATABASE: 'db' | |
# So you don't have to use root, but you can if you like | |
MYSQL_USER: 'sa' | |
# You can use whatever password you like |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3" | |
services: | |
rabbitmq: | |
hostname: "development-rabbit" | |
image: "rabbitmq:3-management" | |
ports: | |
- "5672:5672" | |
- "15672:15672" | |
volumes: | |
- 'rabbitmq_log:/var/log/rabbitmq' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Unbuffered channels block if they are not read from. Buffered channels will not block until they hit capacity. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3' | |
services: | |
elasticsearch: | |
image: elasticsearch:7.17.3 | |
container_name: elasticsearch | |
ports: | |
- "9200:9200" | |
- "9300:9300" | |
restart: always | |
environment: |