Skip to content

Commit

Permalink
[TEMP] [BUG] [TODO] Minor changes to Base and BaseLowFootPrint class …
Browse files Browse the repository at this point in the history
…in src/base.js. Adding Priority and Circular classes
  • Loading branch information
Ganesh K Bhat committed Dec 7, 2022
1 parent fd14b05 commit 3f87a53
Show file tree
Hide file tree
Showing 39 changed files with 975 additions and 173 deletions.
53 changes: 50 additions & 3 deletions .todo
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
[TODO]

- Add Event Handlers for queues - BeforeEvent, Event, ErrorEvent, AfterEvent
[TODO]

- [D] Base Queue
- [D] Queue
- [D] Circular Queue
- [D] Priority Queue
- [T] DoubleEnded Queue (DEQueue)
- [T] Stack
- [T] Semaphore

- USE CASES:

- [] Normal Implement
- [] Cached Counter Base
- [] LIFO
- [] FIFO
- [] Low memory foot print
- [] LIFO
- [] FIFO
- [] Async Implement
- [] Cached Counter Base
- [] LIFO
- [] FIFO
- [] Low memory foot print
- [] LIFO
- [] FIFO

- [T] Add Event Handlers for queues

- [] BeforeEvent
- [] Event
- [] AfterEvent
- [] ErrorEvent

- [] Consider RX.js features inbuilt https://github.com/reactivex/rxjs

- [] Consider base functions like
- Limit, Debounce, Throttle, Queue https://www.npmjs.com/package/p-limit
- [] https://www.npmjs.com/package/promise-throttle-all
- [] https://www.npmjs.com/package/concurrent-task
- [] https://www.npmjs.com/package/concurrencylimit
- [] Consider something similar or put as dependency https://www.npmjs.com/package/rx-queue
- [] https://www.npmjs.com/package/node-traffic
- Queues
- [] https://www.npmjs.com/package/partition-queue
- [] https://www.npmjs.com/package/rx-queue
- [] https://www.npmjs.com/package/task-queue
- [] https://www.npmjs.com/package/concurrency-queue
- [] https://www.npmjs.com/package/@sebowy/concurrent-queue

- remove packages - "denque": "^2.1.0", "synchronization-js": "^1.0.4"
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,8 @@

npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation


## INDEVELOPMENT - DO NOT INSTALL


### Base

```
Expand Down Expand Up @@ -49,3 +47,4 @@ const { Base, BaseLowFootprint, AsyncBase, AsyncBaseLowFootPrint } = require("qu
```

12 changes: 6 additions & 6 deletions demos/demos.base.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
*
* Package: queues.js
* Package: scale.concurrency
* Author: Ganesh B
* Description: npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: base.js
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/
Expand Down
16 changes: 16 additions & 0 deletions demos/demos.base.lowfootprint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';
36 changes: 36 additions & 0 deletions demos/demos.circular.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';

const { Circular } = require("../index");

let c = new Circular();

c.add([1, 2, 3, 4, 5, 6]);
console.log(c.items);
c.add([1, 32]);
console.log(c.items);
c.pop();
c.pop();
c.pop();
console.log(c.items);
c.pop();
c.pop();
console.log(c.items);
c.pop();
c.pop();
console.log(c.items);

36 changes: 36 additions & 0 deletions demos/demos.circular.lowfootprint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';

const { Circular } = require("../index");

let c = new Circular();

c.add([1, 2, 3, 4, 5, 6]);
console.log(c.items);
c.add([1, 32]);
console.log(c.items);
c.pop();
c.pop();
c.pop();
console.log(c.items);
c.pop();
c.pop();
console.log(c.items);
c.pop();
c.pop();
console.log(c.items);

12 changes: 6 additions & 6 deletions demos/demos.double.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
*
* Package: queues.js
* Package: scale.concurrency
* Author: Ganesh B
* Description: npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: double.js
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/
Expand Down
16 changes: 16 additions & 0 deletions demos/demos.double.lowfootprint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';
12 changes: 6 additions & 6 deletions demos/demos.queue.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
*
* Package: queues.js
* Package: scale.concurrency
* Author: Ganesh B
* Description: npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: queue.js
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/
Expand Down
16 changes: 16 additions & 0 deletions demos/demos.queue.lowfootprint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';
12 changes: 6 additions & 6 deletions demos/demos.semaphore.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
*
* Package: queues.js
* Package: scale.concurrency
* Author: Ganesh B
* Description: npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: semaphore.js
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/
Expand Down
12 changes: 6 additions & 6 deletions demos/demos.stack.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/**
*
* Package: queues.js
* Package: scale.concurrency
* Author: Ganesh B
* Description: npm module for start ended lifo/ fifo, normal js ended lifo/ fifo, double ended queue and semaphore queue implementation
* Install: npm i queues.js --save
* Github: https://github.com/ganeshkbhat/queues.js
* npmjs Link: https://www.npmjs.com/package/queues.js
* File: stack.js
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/
Expand Down
16 changes: 16 additions & 0 deletions demos/demos.stack.lowfootprint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/**
*
* Package: scale.concurrency
* Author: Ganesh B
* Description:
* Install: npm i scale.concurrency --save
* Github: https://github.com/ganeshkbhat/scale.concurrency
* npmjs Link: https://www.npmjs.com/package/scale.concurrency
* File: .js
* File Description: .js
*
*/

/* eslint no-console: 0 */

'use strict';
15 changes: 13 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@

// const { Queue, QueueLowFootprint, AsyncQueue } = require("./src/queue.js");
const { Base, BaseLowFootprint, AsyncBase, AsyncBaseLowFootPrint } = require("./src/base.js");

const { Queue, QueueLowFootprint, AsyncQueue, AsyncQueueLowFootprint } = require("./src/queue.js");
const { Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint } = require("./src/stack.js");
const { Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint } = require("./src/priority.js");
const { Circular, AsyncCircular } = require("./src/circular.js");
const { DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint } = require("./src/double.js");
const { Semaphore } = require("./src/semaphore.js");



module.exports.Base = Base;
module.exports.BaseLowFootprint = BaseLowFootprint;
module.exports.AsyncBase = AsyncBase;
Expand All @@ -44,10 +46,19 @@ module.exports.DoubleEndedLowFootprint = DoubleEndedLowFootprint;
module.exports.AsyncDoubleEnded = AsyncDoubleEnded;
module.exports.AsyncDoubleEndedLowFootprint = AsyncDoubleEndedLowFootprint;

module.exports.Priority = Priority;
module.exports.PriorityLowFootprint = PriorityLowFootprint;
module.exports.AsyncPriority = AsyncPriority;
module.exports.AsyncPriorityLowFootprint = AsyncPriorityLowFootprint;

module.exports.Circular = Circular;
module.exports.AsyncCircular = AsyncCircular;

module.exports.default = {
Base, BaseLowFootprint, AsyncBase, AsyncBaseLowFootPrint,
Queue, QueueLowFootprint, AsyncQueue, AsyncQueueLowFootprint,
Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint,
DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint,
Semaphore
Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint,
Circular, AsyncCircular, Semaphore
};
8 changes: 5 additions & 3 deletions index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ import {
Queue, QueueLowFootprint, AsyncQueue, AsyncQueueLowFootprint,
Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint,
DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint,
Semaphore
Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint,
Circular, AsyncCircular, Semaphore
} from "./index.js";

export default queues;
Expand All @@ -32,5 +33,6 @@ export {
Queue, QueueLowFootprint, AsyncQueue, AsyncQueueLowFootprint,
Stack, StackLowFootprint, AsyncStack, AsyncStackLowFootprint,
DoubleEnded, DoubleEndedLowFootprint, AsyncDoubleEnded, AsyncDoubleEndedLowFootprint,
Semaphore
}
Priority, PriorityLowFootprint, AsyncPriority, AsyncPriorityLowFootprint,
Circular, AsyncCircular, Semaphore
};
Loading

0 comments on commit 3f87a53

Please sign in to comment.