Improve DSPS Readme and remove todos.

Change-Id: Id82ad846dd566306d41db211d9ae9a9370192306
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/336540
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
This commit is contained in:
Dan Chevalier 2023-11-16 21:00:29 +00:00 committed by Commit Queue
parent dd03188661
commit 272b9d28a8
5 changed files with 43 additions and 30 deletions

View file

@ -0,0 +1,27 @@
Copyright 2023, the Dart project authors.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials provided
with the distribution.
* Neither the name of Google LLC nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View file

@ -1,30 +1,24 @@
An unlisted package for sharing code for Service Events and stream management between Dart SDK internal services.
An unlisted package for sharing code for service events and stream management between Dart SDK internal services.
The Dart Developer Service and Dart Tooling Daemon are the main consumers of this package.
**Expected SLO**: this package is maintained for our own tooling; we may not be able to respond to all issues and may only address the ones that we ourselves encounter.
## Features
## Details
* Stream Manager
* Helpers for managing streams that listeners can subscribe to.
* Service Events
* Helpers for setting up services that clients can call methods from.
## Getting started
TODO(@CoderDake): List prerequisites and provide or point to information on how to
start using the package.
This package helps handle some of the plumbing required to setup client communication for a service. The main behavior that it helps with is:
- `StreamManager`
- allows a client to subscribe/cancel to a stream with `streamListen`/`streamCancel`.
- allows a client to post a message to a stream with `postEvent`.
- `Client`, an interface that ensures the client is equipped to:
- handle method requests with `sendRequest`.
- handle receiving a message sent to a stream with `streamNotify`.
- `ClientManager`, keeps track of clients connected to a service.
- `addClient` should be called when a client connects to your service.
- `removeClient` should be called when it disconnects.
## Usage
### Stream Manager
TODO(@CoderDake): add Stream Manager Usage
### Service Events
TODO(@CoderDake): add Service Event Usage
## Additional information
TODO(@CoderDake): Fill out Additional information
To see an example of how `dart_service_protocol_shared` is used see:
* [Dart Developer Service](https://github.com/dart-lang/sdk/tree/main/pkg/dds)

View file

@ -1,7 +0,0 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
void main() {
// TODO(CoderDake): Implement examples
}

View file

@ -8,8 +8,7 @@ import 'client.dart';
/// Manages state related to stream subscriptions made by [Client]s.
abstract class StreamManager {
final _streamListeners =
<String, List<Client>>{}; // TODO should this be set of StreamClient?
final _streamListeners = <String, List<Client>>{};
List<Client>? getListenersFor({required String stream}) =>
_streamListeners[stream];

View file

@ -1,7 +1,7 @@
name: dart_service_protocol_shared
description: A package that implements service extensions and stream managers.
version: 0.0.1-dev
version: 0.0.1
repository: https://github.com/dart-lang/sdk/tree/main/pkg/dart_service_protocol_shared
environment: