...

Package mars

import "github.com/Diarkis/diarkis/mars"
Overview
Index

Overview ▾

func Setup

func Setup()

Setup sets up MARS server

type SharedData

SharedData is shared and updated by any server node in Diarkis cluster. The number of shared data entry is limited and dictated by util.SharedDataLimitLength

type SharedData struct {
    sync.RWMutex
    // contains filtered or unexported fields
}

func NewSharedData

func NewSharedData() *SharedData

NewSharedData creates a new SharedData instance.

func (*SharedData) EncodeSharedData

func (sd *SharedData) EncodeSharedData() []byte

EncodeSharedData encodes the SharedData value into a byte array.

func (*SharedData) FlushRemovedKeys

func (sd *SharedData) FlushRemovedKeys() map[string]int16

FlushRemovedKeys flushes out removed keys from the memory.

func (*SharedData) GetSharedData

func (sd *SharedData) GetSharedData() map[string]interface{}

GetSharedData returns the value of SharedData.

func (*SharedData) Update

func (sd *SharedData) Update(key string, value interface{}, set bool) bool

Update changes SharedData value and propagate the change to all pods in the cluster. Update does not change the value atomically therefore it may suffer from race condition.