Commit f711127d authored by Ignacio Corderi's avatar Ignacio Corderi
Browse files

Added media scan

parent f7b0f396
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -3,10 +3,16 @@ Changes since 0.7.3
This section will document changes to the library since the last release

## Important
- Kinetic Protocol version updated to 3.0.0
- Kinetic Protocol version updated to [3.0.0](https://github.com/Seagate/kinetic-protocol/tree/3.0.0)

## New features
- Added `--version` to cmd line tool
- Added background operations Scan and Optimize (Requires proto 3.0.0)

## Behavior changes
- Removed GreenClient (Feature overlap with AsyncClient)
- Removed PipelinedClient (Only used internally by the kineticc)


Changes from 0.7.2 to 0.7.3
===========================
@@ -30,7 +36,7 @@ Changes from 0.7.1 to 0.7.2
===========================

## Important
- Kinetic Protocol version updated to 2.0.5
- Kinetic Protocol version updated to [2.0.5](https://github.com/Seagate/kinetic-protocol/tree/2.0.5)
- The compiled python proto kinetic/kinetic_pb2.py is now included on the repo

## New features
+4 −0
Original line number Diff line number Diff line
@@ -87,6 +87,10 @@ class Client(BaseClient):
    def flush(self, *args, **kwargs):
        return self._process(operations.Flush, *args, **kwargs)

    # @RequiresProtocol('3.0.0')
    def media_scan(self, *args, **kwargs):
        return self._process(operations.MediaScan, *args, **kwargs)

class KineticRangeIter(object):

    def __init__(self, client, startKey, endKey, startKeyInclusive,endKeyInclusive, prefetch):
+37 −0
Original line number Diff line number Diff line
@@ -471,3 +471,40 @@ class Security(object):
    @staticmethod
    def onError(e):
        raise e

###########################
#  Background operations  #
###########################
class MediaScan(object):

    @staticmethod
    def build(startKey=None, endKey=None, startKeyInclusive=True, endKeyInclusive=True, maxReturned=200):
        if not startKey:
            startKey = ''
        if not endKey:
            endKey = '\xFF' * common.MAX_KEY_SIZE

        m = messages.Command()

        m.header.messageType = messages.Command.BACKOP

        op = m.body.backgroundOperation
        op.backOpType = messages.Command.BackgroundOperation.MEDIASCAN

        kr = op.range
        kr.startKey = startKey
        kr.endKey = endKey
        kr.startKeyInclusive = startKeyInclusive
        kr.endKeyInclusive = endKeyInclusive
        kr.maxReturned = maxReturned

        return (m, None)

    @staticmethod
    def parse(m, value):
        r = m.body.backgroundOperation.range
        return ([k for k in r.keys], r.endKey)

    @staticmethod
    def onError(e):
        raise e