<gh_stars>0
package stateservice

import (
	"encoding/gob"
	"log"
	"net"
	"sync"
)

type Updater interface {
	Update(name string, value interface{})
}

// Client is a connection to the stateservice.
type Client struct {
	values       map[string]interface{}
	outgoingChan chan mutationMessage
	conn         net.Conn
	updater      Updater
	lock         sync.Mutex
}

// NewClient makes a new Client
func NewClient(conn net.Conn, updater Updater) *Client {
	client := &Client{
		values:       make(map[string]interface{}),
		outgoingChan: make(chan mutationMessage),
		conn:         conn,
		updater: updater,
	}
	go client.handleOutgoingMessages()
	go client.handleIncommingMessages()
	return client
}

// GetValue retrieves a particlar key's value from the stateservice.
// Nil will be returned in the event that the key does not exist.
func (c *Client) GetValue(name string) interface{} {
	c.lock.Lock()
	defer c.lock.Unlock()
	return c.values[name]
}

// GetValues retrieves a particlar key's value from the stateservice.
// Nil will be returned in the event that the key does not exist.
func (c *Client) GetValues(names...string) map[string]interface{} {
	ret := make(map[string]interface{})
	c.lock.Lock()
	defer c.lock.Unlock()
	for _, name := range names {
		v := c.values[name]
		if v == nil {
			continue
		}
		ret[name] = v
	}
	return ret
}

// SetValues writes to the stateservices.
// Note that some time will need to pass before changes are reflected via GetValue.
func (c *Client) SetValues(mutations map[string]interface{}) {
	c.outgoingChan <- mutationMessage{
		Mutations: mutations,
	}
}

// SetValue is a convenience function for setting a single value.
func (c *Client) SetValue(key string, value interface{}) {
	c.SetValues(map[string]interface{}{
		key: value,
	})
}

func (c *Client) handleOutgoingMessages() {
	encoder := gob.NewEncoder(c.conn)
	for msg := range c.outgoingChan {
		if err := encoder.Encode(msg); err!= nil {
			log.Fatal(err)
		}
	}
}

func (c *Client) handleIncommingMessages() {
	decoder := gob.NewDecoder(c.conn)
	for {
		msg := mutationMessage{}
		if err := decoder.Decode(&msg); err!= nil {
			log.Fatal(err)
		}
		c.lock.Lock()
		for name, value := range msg.Mutations {
			c.values[name] = value
		}
		c.lock.Unlock()
		if c.updater == nil {
			continue
		}
		for name, value := range msg.Mutations {
			c.updater.Update(name, value)
		}
	}
}
Classes begin September 2021, with a get acquainted meeting on September 2nd (time will be announced at a later date). Class size is limited. Birth certificate and proof of immunizations/ TB test are required at the get acquainted meeting. Parents will be asked to contribute juice, snacks, disinfectant wipes, and a $25 material fee. Families registered will be given one week of priority registration for each consecutive session.
This class is for the child entering kindergarten August 2022. We offer the pre-kindergarten child an atmosphere in which to develop kindergarten readiness skills. Language and motor skills will be nourished through games, play, crafts, stories, and songs. Children must be age 4 by December 1, 2021 and will no longer be eligible for the program once they turn 4 years and 10 months.
I just caught a sight of a bike flying by.
How they long to get a sight of their native land!

He yearned for a sight of the old, familiar faces.
make a sight of oneself	故意使人注意,出洋相...
catch a sight of	看到(忽然看见...
have a sight of	看到(忽然看见...
take a sight of someone	以拇指顶着鼻尖张摇其...
get a sight of	看到(忽然看见...
May 28, 2021
The SCC Takes on Snowbanks – May 28, 2021
A CANADIAN CLASSIC – THE SUPREME COURT OF CANADA TAKES ON SNOWBANKS
The Supreme Court of Canada Revisits the Dichotomy between Policy and Operational Decisions in Municipal Negligence Cases
The Supreme Court of Canada (SCC) recently heard the case of Nelson (City) v. Marchi, 2020 CanLII 57554 (SCC). This is likely to be a key ruling in respect of determining if and when local governments will be held liable for negligence. The central issue here for the court to decide is whether certain acts or omissions on the part of a local government should be considered policy decisions and therefore immune from judicial review.
Following a heavy snowfall in January of 2015, the City of Nelson deployed snow clearing services within its downtown core in accordance with a longstanding winter maintenance policy. In doing so, it piled the snow cleared from the roadways into low level windrows that bordered the City’s sidewalks. The Plaintiff had parked her car on the side of the street and encountered such a windrow between her car and the sidewalk. The Plaintiff stepped on top of the windrow in an effort to get to the sidewalk. As she did, her foot fell through it injuring her leg.
At trial the Plaintiff argued that the City had been negligent for failing to provide her with safe access from the street to the sidewalk. The City defended the claim on the basis that it had a policy in place which had been followed and therefore the acts or omissions of the City were immune from judicial scrutiny.
In dismissing the Plaintiff’s claim, the British Columbia Supreme Court (BCSC) held that the City owed the Plaintiff no duty of care given that it had followed a well-established winter maintenance policy for snow clearing. The Plaintiff’s attempt to compare the City’s policy to that of other cities was not helpful as those cities experienced different conditions. Snow and windrows were held to be an unavoidable feature of winters in British Columbia which the Plaintiff knew well having lived in the area her entire life. She appreciated the risk when she decided to step on top of the windrow, not knowing whether it would bear her weight. She had considered other options like walking down the street to an intersection, but had rejected them. In so choosing, the Plaintiff was found to have been the author of her own misfortune. The BCSC’s decision can be found here: Marchi v Nelson (City of), 2019 BCSC 308
In allowing the Plaintiff’s appeal, the British Columbia Court of Appeal (BCAA) (Marchi v. Nelson (City of), 2020 BCCA 1) held that it had been an error for the court below to have characterized the City’s acts or omissions as “policy” decisions without first having engaged in the proper analysis as was originally set out by the SCC in the case of Just v. British Columbia, (1989) 2 SCR 1228.
In Just v. British Columbia, the SCC held that scrutiny must be applied to the impugned conduct to determine whether it was: (a) a pure policy decision based on financial, social and political constraints and therefore immune from judicial review; or (b) operational in nature and to be assessed on a standard negligence analysis.
With respect to the City of Nelson, the BCCA held that the manner in which the snow was cleared (i.e., the creation if windrows between the street and the sidewalk without also creating pedestrian access points) may have properly been characterized as operational in nature and ought to have been the subject of judicial scrutiny. A new trial was ordered. The City then went on to appeal this order to the SCC.
Takeaway
The SCC hearing for the appeal was just recently heard. The fact that the SCC was willing to hear the City’s appeal likely reflects a desire to revisit and clarify the dichotomy between policy and operational decisions. The number of intervenors in this case demonstrate the significance of the issue (including the Attorney General of Canada,
numerous provincial Attorneys General, provincial Trial Lawyers Associations and the Cities of Toronto and Abbotsford). The SCC’s ruling, once made, is likely to be instrumental for municipal negligence cases going forward.
A further article will be published upon the release of the SCC’s decision, which is not expected for some time. In the meantime, public policy makers and those who insure them should be cognizant that the SCC’s decision may increase the scope of a public body’s duty of